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

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

[elpa] externals/transient e4ffb97a68 018/366: transient--layout-member:


From: Jonas Bernoulli
Subject: [elpa] externals/transient e4ffb97a68 018/366: transient--layout-member: Match indirect key bindings
Date: Tue, 25 Jan 2022 18:54:22 -0500 (EST)

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

    transient--layout-member: Match indirect key bindings
    
    The key binding may be defined in the suffix object instead in
    the suffixes spec.
---
 lisp/transient.el | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 3af24f65a5..2d05406e10 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -860,13 +860,26 @@ PROP has to be a keyword.  What keywords and values
                             (aset layout 3 (delq (car cons) list)))
                         cons))))
                  ((and (listp layout)
-                       (if (symbolp loc)
-                           (eq (plist-get (nth 2 layout) :command) loc)
-                         (equal (key (plist-get (nth 2 layout) :key)) loc)))
+                       (let* ((def (nth 2 layout))
+                              (cmd (plist-get def :command)))
+                         (if (symbolp loc)
+                             (eq cmd loc)
+                           (equal (key (or (plist-get def :key)
+                                           (transient--command-key cmd)))
+                                  loc))))
                   layout))))
         (mem layout (key loc)))
     (error "%s is not a transient command" prefix)))
 
+(defun transient--command-key (cmd)
+  (when-let ((obj (get cmd 'transient--suffix)))
+    (cond ((slot-boundp obj 'key)
+           (oref obj key))
+          ((slot-exists-p obj 'shortarg)
+           (if (slot-boundp obj 'shortarg)
+               (oref obj shortarg)
+             (transient--derive-shortarg (oref obj argument)))))))
+
 ;;; Variables
 
 (defvar current-transient-prefix nil



reply via email to

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