diff options
| author | Jonas Bernoulli | 2023-02-20 16:36:16 +0100 |
|---|---|---|
| committer | Jonas Bernoulli | 2023-02-20 16:36:16 +0100 |
| commit | 02aba20d528f1ec45ad36424e8d65ace985dd04a (patch) | |
| tree | 8c92ba7d531785bcf28b5d4632037b504a2823d8 | |
| parent | d7010d64b216b3adf7dd5adcc9bb62c7208b8d43 (diff) | |
| download | emacs-02aba20d528f1ec45ad36424e8d65ace985dd04a.tar.gz emacs-02aba20d528f1ec45ad36424e8d65ace985dd04a.zip | |
Update to Transient v0.3.7-216-gfe40342
| -rw-r--r-- | doc/misc/transient.texi | 5 | ||||
| -rw-r--r-- | 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: | |||
| 1214 | 1214 | ||
| 1215 | @lisp | 1215 | @lisp |
| 1216 | ([@var{LEVEL}] | 1216 | ([@var{LEVEL}] |
| 1217 | [@var{KEY}] [@var{DESCRIPTION}] | 1217 | [@var{KEY} [@var{DESCRIPTION}]] |
| 1218 | @var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...) | 1218 | @var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...) |
| 1219 | @end lisp | 1219 | @end lisp |
| 1220 | 1220 | ||
| @@ -1253,8 +1253,7 @@ Any command will do; it does not need to have an object associated | |||
| 1253 | with it (as would be the case if @code{transient-define-suffix} or | 1253 | with it (as would be the case if @code{transient-define-suffix} or |
| 1254 | @code{transient-define-infix} were used to define it). | 1254 | @code{transient-define-infix} were used to define it). |
| 1255 | 1255 | ||
| 1256 | Anonymous, dynamically defined suffix commands are also supported. | 1256 | COMMAND can also be a @code{lambda} expression. |
| 1257 | See information about the @code{:setup-children} function in @ref{Group Specifications}. | ||
| 1258 | 1257 | ||
| 1259 | As mentioned above, the object that is associated with a command can | 1258 | As mentioned above, the object that is associated with a command can |
| 1260 | be used to set the default for certain values that otherwise have to | 1259 | 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. | |||
| 1048 | (setq args (plist-put args :key pop))) | 1048 | (setq args (plist-put args :key pop))) |
| 1049 | (cond | 1049 | (cond |
| 1050 | ((or (stringp car) | 1050 | ((or (stringp car) |
| 1051 | (eq (car-safe car) 'lambda)) | 1051 | (and (eq (car-safe car) 'lambda) |
| 1052 | (not (commandp car)))) | ||
| 1052 | (setq args (plist-put args :description pop))) | 1053 | (setq args (plist-put args :description pop))) |
| 1053 | ((and (symbolp car) | 1054 | ((and (symbolp car) |
| 1055 | (not (keywordp car)) | ||
| 1054 | (not (commandp car)) | 1056 | (not (commandp car)) |
| 1055 | (commandp (cadr spec))) | 1057 | (commandp (cadr spec))) |
| 1056 | (setq args (plist-put args :description (macroexp-quote pop))))) | 1058 | (setq args (plist-put args :description (macroexp-quote pop))))) |
| 1057 | (cond | 1059 | (cond |
| 1058 | ((keywordp car) | 1060 | ((keywordp car) |
| 1059 | (error "Need command, got %S" car)) | 1061 | (error "Need command, got `%s'" car)) |
| 1060 | ((symbolp car) | 1062 | ((symbolp car) |
| 1061 | (setq args (plist-put args :command (macroexp-quote pop)))) | 1063 | (setq args (plist-put args :command (macroexp-quote pop)))) |
| 1062 | ((and (commandp car) | 1064 | ((and (commandp car) |
| 1063 | (not (stringp car))) | 1065 | (not (stringp car))) |
| 1064 | (let ((cmd pop) | 1066 | (let ((cmd pop) |
| 1065 | (sym (intern (format "transient:%s:%s" | 1067 | (sym (intern |
| 1066 | prefix | 1068 | (format "transient:%s:%s" |
| 1067 | (or (plist-get args :description) | 1069 | prefix |
| 1068 | (plist-get args :key)))))) | 1070 | (let ((desc (plist-get args :description))) |
| 1069 | (defalias sym cmd) | 1071 | (if (and desc (or (stringp desc) (symbolp desc))) |
| 1070 | (setq args (plist-put args :command (macroexp-quote sym))))) | 1072 | desc |
| 1073 | (plist-get args :key))))))) | ||
| 1074 | (setq args (plist-put args :command `(defalias ',sym ,cmd))))) | ||
| 1071 | ((or (stringp car) | 1075 | ((or (stringp car) |
| 1072 | (and car (listp car))) | 1076 | (and car (listp car))) |
| 1073 | (let ((arg pop)) | 1077 | (let ((arg pop)) |