Skip to content

Commit 02aba20

Browse files
committed
Update to Transient v0.3.7-216-gfe40342
1 parent d7010d6 commit 02aba20

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

doc/misc/transient.texi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ Suffix specifications have this form:
12141214

12151215
@lisp
12161216
([@var{LEVEL}]
1217-
[@var{KEY}] [@var{DESCRIPTION}]
1217+
[@var{KEY} [@var{DESCRIPTION}]]
12181218
@var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...)
12191219
@end lisp
12201220

@@ -1253,8 +1253,7 @@ Any command will do; it does not need to have an object associated
12531253
with it (as would be the case if @code{transient-define-suffix} or
12541254
@code{transient-define-infix} were used to define it).
12551255

1256-
Anonymous, dynamically defined suffix commands are also supported.
1257-
See information about the @code{:setup-children} function in @ref{Group Specifications}.
1256+
COMMAND can also be a @code{lambda} expression.
12581257

12591258
As mentioned above, the object that is associated with a command can
12601259
be used to set the default for certain values that otherwise have to

lisp/transient.el

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,26 +1048,30 @@ example, sets a variable, use `transient-define-infix' instead.
10481048
(setq args (plist-put args :key pop)))
10491049
(cond
10501050
((or (stringp car)
1051-
(eq (car-safe car) 'lambda))
1051+
(and (eq (car-safe car) 'lambda)
1052+
(not (commandp car))))
10521053
(setq args (plist-put args :description pop)))
10531054
((and (symbolp car)
1055+
(not (keywordp car))
10541056
(not (commandp car))
10551057
(commandp (cadr spec)))
10561058
(setq args (plist-put args :description (macroexp-quote pop)))))
10571059
(cond
10581060
((keywordp car)
1059-
(error "Need command, got %S" car))
1061+
(error "Need command, got `%s'" car))
10601062
((symbolp car)
10611063
(setq args (plist-put args :command (macroexp-quote pop))))
10621064
((and (commandp car)
10631065
(not (stringp car)))
10641066
(let ((cmd pop)
1065-
(sym (intern (format "transient:%s:%s"
1066-
prefix
1067-
(or (plist-get args :description)
1068-
(plist-get args :key))))))
1069-
(defalias sym cmd)
1070-
(setq args (plist-put args :command (macroexp-quote sym)))))
1067+
(sym (intern
1068+
(format "transient:%s:%s"
1069+
prefix
1070+
(let ((desc (plist-get args :description)))
1071+
(if (and desc (or (stringp desc) (symbolp desc)))
1072+
desc
1073+
(plist-get args :key)))))))
1074+
(setq args (plist-put args :command `(defalias ',sym ,cmd)))))
10711075
((or (stringp car)
10721076
(and car (listp car)))
10731077
(let ((arg pop))

0 commit comments

Comments
 (0)