From 3c9d1cc6871ff5c188d73b285589c51c5b664f6e Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 29 Mar 2025 21:44:38 +0100 Subject: [PATCH] (macroexp-quote): Add optional argument Q. --- lisp/emacs-lisp/macroexp.el | 6 +++--- lisp/transient.el | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index bd4c55dae6c..acd2b6f0b05 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -710,17 +710,17 @@ symbol itself." "Return non-nil if EXP can be copied without extra cost." (or (symbolp exp) (macroexp-const-p exp))) -(defun macroexp-quote (v) +(defun macroexp-quote (v &optional q) "Return an expression E such that `(eval E)' is V. -E is either V or (quote V) depending on whether V evaluates to +E is either V or (Q V) depending on whether V evaluates to itself or not." (if (and (not (consp v)) (or (keywordp v) (not (symbolp v)) (memq v '(nil t)))) v - (list 'quote v))) + (list (or q 'quote) v))) (defun macroexp--fgrep (bindings sexp) "Return those of the BINDINGS which might be used in SEXP. diff --git a/lisp/transient.el b/lisp/transient.el index 0d9d4d84f62..1c4a3793ed2 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -1278,7 +1278,7 @@ commands are aliases for." ((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 (macroexp-quote (pop spec) 'function))) ;; 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 -- 2.39.5