diff --git a/lisp/transient.el b/lisp/transient.el index f30daf4..170846f 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1149,10 +1149,7 @@ commands are aliases for." (val (if spec (pop spec) (error "No value for `%s'" key)))) (cond ((eq key :class) (setq class val)) - ((or (symbolp val) - (and (listp val) (not (eq (car val) 'lambda)))) - (setq args (plist-put args key (macroexp-quote val)))) - ((setq args (plist-put args key val)))))) + ((setq args (plist-put args key (transient--quote val))))))) (unless (or spec class (not (plist-get args :setup-children))) (message "WARNING: %s: When %s is used, %s must also be specified" 'transient-define-prefix :setup-children :class)) @@ -1180,19 +1177,17 @@ commands are aliases for." ((cl-type (or string vector)) (use :key (pop spec)))) (pcase (car spec) - ((guard (or (stringp (car spec)) - (and (eq (car-safe (car spec)) 'lambda) - (not (commandp (car spec)))))) - (use :description (pop spec))) - ((and (cl-type (and symbol (not keyword) (not command))) - (guard (commandp (cadr spec)))) - (use :description (macroexp-quote (pop spec))))) + ((or (cl-type string) + (cl-type (and function (not command))) + (and (cl-type (and symbol (not keyword) (not command))) + (guard (commandp (cadr spec))))) + (use :description (transient--quote (pop spec))))) (pcase (car spec) ((or :info :info*)) ((and (cl-type keyword) invalid) (error "Need command, argument, `:info' or `:info*'; got `%s'" invalid)) ((cl-type symbol) - (use :command (macroexp-quote (pop spec)))) + (use :command (list 'quote (pop spec)))) ;; During macro-expansion this is expected to be a `lambda' ;; expression (i.e., source code). When this is called from a ;; `:setup-children' function, it may also be a function object @@ -1230,7 +1225,7 @@ commands are aliases for." (pcase (car spec) ((cl-type (and (not null) (not keyword))) (setq class 'transient-option) - (use :reader (macroexp-quote (pop spec)))) + (use :reader (transient--quote (pop spec)))) ((guard (string-suffix-p "=" arg)) (setq class 'transient-option)) (_ (setq class 'transient-switch))))) @@ -1248,10 +1243,7 @@ commands are aliases for." (use :description val)) ((guard (eq (car-safe val) '\,)) (use key (cadr val))) - ((guard (or (symbolp val) - (and (listp val) (not (eq (car val) 'lambda))))) - (use key (macroexp-quote val))) - (_ (use key val))))) + (_ (use key (transient--quote val)))))) (when spec (error "Need keyword, got %S" (car spec))) (when-let* (((not (plist-get args :key))) @@ -1259,9 +1251,12 @@ commands are aliases for." (use :key shortarg))) (list 'list (or level transient--default-child-level) - (macroexp-quote (or class 'transient-suffix)) + (list 'quote (or class 'transient-suffix)) (cons 'list args)))) +(defun transient--quote (v) + (if (memq (car-safe v) '(lambda closure)) v (macroexp-quote v))) + (defun transient--derive-shortarg (arg) (save-match-data (and (string-match "\\`\\(-[a-zA-Z]\\)\\(\\'\\|=\\)" arg)