branch: externals/transient commit 0ae0de43590b5b6984a83f9e044e7c426455ac6e Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
transient--invalid: Add special-case for anonymous inapt commands Closes #241. --- lisp/transient.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/transient.el b/lisp/transient.el index 840ab992d4..5c1b0a2ccf 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -2516,17 +2516,22 @@ prefix argument and pivot to `transient-update'." (defun transient--invalid (msg) (ding) - (message "%s: `%s' (Use `%s' to abort, `%s' for help) [%s]" + (message "%s: `%s' (Use `%s' to abort, `%s' for help)%s" msg (propertize (key-description (this-single-command-keys)) 'face 'font-lock-warning-face) (propertize "C-g" 'face 'transient-key) (propertize "?" 'face 'transient-key) - ;; `this-command' is `transient--undefined' or similar at this - ;; point. Show the command the user actually tried to invoke. - (propertize (symbol-name (transient--suffix-symbol - this-original-command)) - 'face 'font-lock-warning-face)) + ;; `this-command' is `transient-undefined' or `transient-inapt'. + ;; Show the command (`this-original-command') the user actually + ;; tried to invoke. For an anonymous inapt command that is a + ;; lambda expression, which cannot be mapped to a symbol, so + ;; forgo displaying the command. + (if-let ((cmd (ignore-errors + (symbol-name (transient--suffix-symbol + this-original-command))))) + (format " [%s]" (propertize cmd 'face 'font-lock-warning-face)) + "")) (unless (and transient--transient-map (memq transient--transient-map overriding-terminal-local-map)) (let ((transient--prefix (or transient--prefix 'sic)))