emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/transient a729bbba45 022/366: transient--ensure-infix-c


From: Jonas Bernoulli
Subject: [elpa] externals/transient a729bbba45 022/366: transient--ensure-infix-command: Avoid false-positives
Date: Tue, 25 Jan 2022 18:54:23 -0500 (EST)

branch: externals/transient
commit a729bbba4529f38a56849699c66a1d020963ba62
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    transient--ensure-infix-command: Avoid false-positives
    
    This function is supposed to generate the command for an anonymous
    infix argument but until now it also generated a command for other
    kinds of suffixes if the command was not defined or autoloaded.
    
    Now this function detects that issue and raises an informative error
    instead of defining a bogus command, which then caused a confusing
    error later on.
    
    Closes https://github.com/magit/magit/issues/3761.
---
 lisp/transient.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index c58349a7bf..ba1210ffe6 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -752,8 +752,12 @@ example, sets a variable use `define-infix-command' 
instead.
   (let ((cmd (oref obj command)))
     (unless (or (commandp cmd)
                 (get cmd 'transient--infix-command))
-      (put cmd 'transient--infix-command
-           (transient--default-infix-command)))))
+      (if (or (cl-typep obj 'transient-switch)
+              (cl-typep obj 'transient-option))
+          (put cmd 'transient--infix-command
+               (transient--default-infix-command))
+        ;; This is not an anonymous infix argument.
+        (error "Suffix %s is not defined or autoloaded as a command" cmd)))))
 
 (defun transient--derive-shortarg (arg)
   (save-match-data



reply via email to

[Prev in Thread] Current Thread [Next in Thread]