summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2024-11-02 12:54:01 +0100
committerJonas Bernoulli <jonas@bernoul.li>2024-11-02 12:54:01 +0100
commitd9ced840fa89dba2e22708d1e247f310da139245 (patch)
treea296b0fd268a66ee54b3f1de8f6a69e17aeecdbb
parent0ed009491910f5466ad7f95b4576e9dde7156f4e (diff)
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.
-rw-r--r--CHANGELOG3
-rw-r--r--lisp/transient.el5
2 files changed, 6 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 454ac36..63b2b1e 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 0575dc7..cb4243d 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