Function: transient-set-level

transient-set-level is an interactive and byte-compiled function defined in transient.el.

Signature

(transient-set-level &optional COMMAND LEVEL)

Documentation

Set the level of the transient or one of its suffix commands.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/transient-20260414.1009/transient.el
;;;; Level

(defun transient-set-level (&optional command level)
  "Set the level of the transient or one of its suffix commands."
  (interactive
    (let ((command this-original-command)
          (prefix (oref transient--prefix command)))
      (and (or (not (eq command 'transient-set-level))
               (and transient--editp
                    (setq command prefix)))
           (list command
                 (let ((keys (this-single-command-raw-keys)))
                   (and (lookup-key transient--transient-map keys)
                        (progn
                          (transient--show)
                          (string-to-number
                           (transient--read-number-N
                            (format "Set level for `%s': " command)
                            nil nil (not (eq command prefix)))))))))))
  (cond
    ((not command)
     (setq transient--editp t)
     (transient-setup))
    (level
     (let* ((prefix (oref transient--prefix command))
            (alist (alist-get prefix transient-levels))
            (akey command))
       (cond ((eq command prefix)
              (oset transient--prefix level level)
              (setq akey t))
             (t
              (oset (transient-suffix-object command) level level)
              (when (cdr (cl-remove-if-not (lambda (obj)
                                             (eq (oref obj command) command))
                                           transient--suffixes))
                (setq akey (cons command (this-command-keys))))))
       (setf (alist-get akey alist) level)
       (setf (alist-get prefix transient-levels) alist))
     (transient-save-levels)
     (transient--show))
    (t
     (transient-undefined))))