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

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

[elpa] externals/transient d9ced840fa 5/8: transient--make-redisplay-map


From: Jonas Bernoulli
Subject: [elpa] externals/transient d9ced840fa 5/8: transient--make-redisplay-map: Ensure unread-command-events is used
Date: Sat, 2 Nov 2024 09:09:38 -0400 (EDT)

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

    transient--make-redisplay-map: Ensure unread-command-events is used
    
    We use an additional transient keymap, which binds every incomplete key
    sequence, which exists in the keymap with the real suffix bindings, to
    the command `transient-update'.  That command updates the menu, dimming
    all the suffixes that can no longer be reached using the current
    incomplete key sequence.  Additionally it sets `unread-command-events'
    to the incomplete key sequence.  This command is called for every key
    in the sequence individually, but it sets the variable to the full
    sequence.
    
    Turns out, for many purposes, all but the first of these events is
    ignored, which matters as soon as the final sequence has more than two
    elements.  We could start using `this-single-command-raw-keys' more,
    as that always returns the full sequence, but that would not help with
    features implemented outside of Emacs (such as the incomplete sequence
    being shown in the echo area).  So instead use the special (t . KEY)
    form for elements added to `unread-command-events'.  That way we get
    the same behavior we would get if the redisplay map did not exist.
    
    Fixes #324 and similar issues.
---
 CHANGELOG         | 3 +++
 lisp/transient.el | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 454ac3699b..63b2b1eab8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -18,6 +18,9 @@ Bug fixes:
   ~transient-current-*~ variables were not immediately reset to
   ~nil~. #323
 
+- Key sequences with three or more events broke
+  ~transient-suffix-object~.  #324
+
 * v0.7.7    2024-10-04
 
 Bug fix:
diff --git a/lisp/transient.el b/lisp/transient.el
index 0575dc73be..cb4243d511 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2019,8 +2019,9 @@ of the corresponding object."
         (pcase this-command
           ('transient-update
            (setq transient--showp t)
-           (setq unread-command-events
-                 (listify-key-sequence (this-single-command-raw-keys))))
+           (let ((keys (listify-key-sequence (this-single-command-raw-keys))))
+             (setq unread-command-events (mapcar (lambda (key) (cons t key)) 
keys))
+             keys))
           ('transient-quit-seq
            (setq unread-command-events
                  (butlast (listify-key-sequence



reply via email to

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