Function: transient--init-suffix

transient--init-suffix is a byte-compiled function defined in transient.el.

Signature

(transient--init-suffix LEVELS SPEC PARENT)

Source Code

;; Defined in ~/.emacs.d/elpa/transient-20260414.1009/transient.el
(defun transient--init-suffix (levels spec parent)
  (let* ((class  (car spec))
         (args   (cdr spec))
         (cmd    (plist-get args :command))
         (_      (transient--load-command-if-autoload cmd))
         (key    (plist-get args :key))
         (key    (and key (kbd key)))
         (proto  (and cmd (transient--suffix-prototype cmd)))
         (level  (or (alist-get (cons cmd key) levels nil nil #'equal)
                     (alist-get cmd levels)
                     (plist-get args :level)
                     (and proto (oref proto level))
                     transient--default-child-level))
         (args   (plist-put (copy-sequence args) :level level))
         (obj    (if (child-of-class-p class 'transient-information)
                     (apply class :parent parent args)
                   (unless (and cmd (symbolp cmd))
                     (error "BUG: Non-symbolic suffix command: %s" cmd))
                   (if proto
                       (apply #'clone proto :parent parent args)
                     (apply class :command cmd :parent parent args))))
         (active (and (transient--use-level-p level)
                      (transient--use-suffix-p obj)))
         (inapt  (and active (transient--inapt-suffix-p obj)))
         (active (and active (not inapt))))
    (cond (inapt
           (oset obj inapt t))
          ((not active)
           (oset obj inactive t)))
    (cond ((not cmd))
          ((commandp cmd))
          ((or (cl-typep obj 'transient-switch)
               (cl-typep obj 'transient-option))
           ;; As a temporary special case, if the package was compiled
           ;; with an older version of Transient, then we must define
           ;; "anonymous" switch and option commands here.
           (defalias cmd #'transient--default-infix-command))
          (active
           (error "Suffix command %s is not defined or autoloaded" cmd)))
    (cond ((not (cl-typep obj 'transient-information))
           (transient--init-suffix-key obj)
           (transient-init-scope obj)
           (transient-init-value obj)))
    (list obj)))