Function: transient--get-layout

transient--get-layout is a byte-compiled function defined in transient.el.

Signature

(transient--get-layout PREFIX)

Source Code

;; Defined in ~/.emacs.d/elpa/transient-20260414.1009/transient.el
(defun transient--get-layout (prefix)
  (cond-let
    [[layout (or (get prefix 'transient--layout)
                 ;; Migrate unparsed legacy group definition.
                 (condition-case-unless-debug err
                     (and-let ((value (symbol-value prefix)))
                       (transient--set-layout
                        prefix
                        (if (and (listp value)
                                 (or (listp (car value))
                                     (vectorp (car value))))
                            (transient-parse-suffixes prefix value)
                          (list (transient-parse-suffix prefix value)))))
                   (error
                    (message "Not a legacy group definition: %s: %S" prefix err)
                    nil)))]]
    ((not layout)
     (error "Not a transient prefix command or group definition: %s" prefix))
    ((vectorp layout)
     (let ((version (aref layout 0)))
       (if (= version 2)
           layout
         (error "Unsupported layout version %s for %s" version prefix))))
    (t
     ;; Upgrade from version 1.
     (transient--set-layout
      prefix
      (named-let upgrade ((spec layout))
        (cond ((vectorp spec)
               (pcase-let ((`[,level ,class ,args ,children] spec))
                 (when level
                   (setq args (plist-put args :level level)))
                 (vector class args (mapcar #'upgrade children))))
              ((and (listp spec)
                    (length= spec 3)
                    (or (null (car spec))
                        (natnump (car spec)))
                    (symbolp (cadr spec)))
               (pcase-let ((`(,level ,class ,args) spec))
                 (when level
                   (setq args (plist-put args :level level)))
                 (cons class args)))
              ((listp spec)
               (mapcar #'upgrade spec))
              (t spec)))))))