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

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

[elpa] externals/transient b768a30199 174/366: transient--suffix-symbol:


From: Jonas Bernoulli
Subject: [elpa] externals/transient b768a30199 174/366: transient--suffix-symbol: Verify that optimized path can be used
Date: Tue, 25 Jan 2022 18:54:38 -0500 (EST)

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

    transient--suffix-symbol: Verify that optimized path can be used
    
    Otherwise use a more expensive code path, which previously was
    missing completely.
---
 lisp/transient.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index c76bddc55f..6b8a21f771 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1216,12 +1216,24 @@ property holds an anonymous command, which is returned 
instead."
       (get sym 'transient--infix-command))))
 
 (defun transient--suffix-symbol (arg)
+  "Return a symbol representing ARG.
+
+ARG must be a command and/or a symbol.  If it is a symbol,
+then just return it.  Otherwise return the symbol whose
+`transient--infix-command' property's value is ARG."
   (or (cl-typep arg 'command)
       (cl-typep arg 'symbol)
       (signal 'wrong-type-argument `((command symbol) ,arg)))
   (if (symbolp arg)
       arg
-    (oref (transient-suffix-object) command)))
+    (let* ((obj (transient-suffix-object))
+           (sym (oref obj command)))
+      (if (eq (get sym 'transient--infix-command) arg)
+          sym
+        (catch 'found
+          (mapatoms (lambda (sym)
+                      (when (eq (get sym 'transient--infix-command) arg)
+                        (throw 'found sym)))))))))
 
 ;;; Keymaps
 



reply via email to

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