branch: externals/transient commit a6295fa7eea2d7a95c705684064e82ea47e27e44 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Declare that prefix and suffix commands are for interactive use only I intended to do this for a long time but never got around to do it. In all of Magit there were only four cases where a suffix command was called non-interactively. One of them was a bug, another a very special case where the command calls itself non-interactively (now inside `with-no-warnings') and only two cases where we now have to add a tiny bit of duplication to avoid the non-interactive calls. I think that means calling suffix commands non-interactively is not something that is useful often in general. If those very few cases were calling non-interactively is legitimate `with-no-warning' or maybe an explicit "(put SUFFIX 'interactive-only nil)" after the suffix definition should be good enough. For prefix commands I think it is simply always wrong to call them non-interactively. --- lisp/transient.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/transient.el b/lisp/transient.el index ea68131151..1bd23350c5 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -596,6 +596,7 @@ to the setup function: `(lambda () (interactive) (transient-setup ',name)))) + (put ',name 'interactive-only t) (put ',name 'function-documentation ,docstr) (put ',name 'transient--prefix (,(or class 'transient-prefix) :command ',name ,@slots)) @@ -632,6 +633,7 @@ just like for `prefix-arg' and `current-prefix-arg'. (transient--expand-define-args args))) `(progn (defalias ',name (lambda ,arglist ,@body)) + (put ',name 'interactive-only t) (put ',name 'function-documentation ,docstr) (put ',name 'transient--suffix (,(or class 'transient-suffix) :command ',name ,@slots))))) @@ -678,6 +680,7 @@ keyword. (transient--expand-define-args args))) `(progn (defalias ',name ,(transient--default-infix-command)) + (put ',name 'interactive-only t) (put ',name 'function-documentation ,docstr) (put ',name 'transient--suffix (,(or class 'transient-switch) :command ',name ,@slots)))))