emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 02aba20d528: Update to Transient v0.3.7-216-gfe40342


From: Jonas Bernoulli
Subject: emacs-29 02aba20d528: Update to Transient v0.3.7-216-gfe40342
Date: Mon, 20 Feb 2023 11:07:09 -0500 (EST)

branch: emacs-29
commit 02aba20d528f1ec45ad36424e8d65ace985dd04a
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Update to Transient v0.3.7-216-gfe40342
---
 doc/misc/transient.texi |  5 ++---
 lisp/transient.el       | 20 ++++++++++++--------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi
index 7be8b630412..850930a290f 100644
--- a/doc/misc/transient.texi
+++ b/doc/misc/transient.texi
@@ -1214,7 +1214,7 @@ Suffix specifications have this form:
 
 @lisp
 ([@var{LEVEL}]
- [@var{KEY}] [@var{DESCRIPTION}]
+ [@var{KEY} [@var{DESCRIPTION}]]
  @var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...)
 @end lisp
 
@@ -1253,8 +1253,7 @@ Any command will do; it does not need to have an object 
associated
 with it (as would be the case if @code{transient-define-suffix} or
 @code{transient-define-infix} were used to define it).
 
-Anonymous, dynamically defined suffix commands are also supported.
-See information about the @code{:setup-children} function in @ref{Group 
Specifications}.
+COMMAND can also be a @code{lambda} expression.
 
 As mentioned above, the object that is associated with a command can
 be used to set the default for certain values that otherwise have to
diff --git a/lisp/transient.el b/lisp/transient.el
index c0ecd2950d7..96e711e950c 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1048,26 +1048,30 @@ example, sets a variable, use `transient-define-infix' 
instead.
         (setq args (plist-put args :key pop)))
       (cond
        ((or (stringp car)
-            (eq (car-safe car) 'lambda))
+            (and (eq (car-safe car) 'lambda)
+                 (not (commandp car))))
         (setq args (plist-put args :description pop)))
        ((and (symbolp car)
+             (not (keywordp car))
              (not (commandp car))
              (commandp (cadr spec)))
         (setq args (plist-put args :description (macroexp-quote pop)))))
       (cond
        ((keywordp car)
-        (error "Need command, got %S" car))
+        (error "Need command, got `%s'" car))
        ((symbolp car)
         (setq args (plist-put args :command (macroexp-quote pop))))
        ((and (commandp car)
              (not (stringp car)))
         (let ((cmd pop)
-              (sym (intern (format "transient:%s:%s"
-                                   prefix
-                                   (or (plist-get args :description)
-                                       (plist-get args :key))))))
-          (defalias sym cmd)
-          (setq args (plist-put args :command (macroexp-quote sym)))))
+              (sym (intern
+                    (format "transient:%s:%s"
+                            prefix
+                            (let ((desc (plist-get args :description)))
+                              (if (and desc (or (stringp desc) (symbolp desc)))
+                                  desc
+                                (plist-get args :key)))))))
+          (setq args (plist-put args :command `(defalias ',sym ,cmd)))))
        ((or (stringp car)
             (and car (listp car)))
         (let ((arg pop))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]