Update to Transient v0.3.7-216-gfe40342

This commit is contained in:
Jonas Bernoulli 2023-02-20 16:36:16 +01:00
parent d7010d64b2
commit 02aba20d52
No known key found for this signature in database
GPG key ID: 230C2EFBB326D927
2 changed files with 14 additions and 11 deletions

View file

@ -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

View file

@ -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))