@lisp
([@var{LEVEL}]
- [@var{KEY}] [@var{DESCRIPTION}]
+ [@var{KEY} [@var{DESCRIPTION}]]
@var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...)
@end lisp
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
(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))