[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 48238bf 16/18: Allow invoking arbitrary prefi
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 48238bf 16/18: Allow invoking arbitrary prefixes as non-suffixes |
Date: |
Sat, 27 Feb 2021 09:20:12 -0500 (EST) |
branch: externals/transient
commit 48238bf580c0a3e8ea05ffc5ee86eb104404ea3b
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Allow invoking arbitrary prefixes as non-suffixes
When a prefix is explicitly added as a suffix of another "outer"
prefix, then the `transient--do-replace' pre-command function is
added to the predicate map by `transient--make-predicate-map',
which is aware that this is a sub-prefix.
When the "outer" prefix allows arbitrary non-suffix commands to
be invoked while it is active, by setting `transient-non-suffix'
to `transient--do-stay' or `transient--do-call', then there is no
opportunity to configure another predicate for commands that happen
to be prefixes.
This results in a pre-command being called that is not appropriate
for a sub-prefix command because it fails to clean up after the
"outer" prefix command. In particular it fails to remove the active
transient keymaps before adding new keymaps of the new prefix.
That causes them to stick around forever. The redisplay keymap ends
up consume certain key events, such as "C-x", without unreading them
again so that the real bindings can be looked up.
We deal with this by teaching the code that sets up a prefix to check
whether a transient keymap (`transient--transient-map') is still in
effect and if so to take this as a sign that the above is what has
happened and to clean up accordingly.
---
lisp/transient.el | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lisp/transient.el b/lisp/transient.el
index 592ae65..51106e7 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1633,6 +1633,12 @@ EDIT may be non-nil."
(transient--pop-keymap 'transient--redisplay-map)
(setq name (oref transient--prefix command))
(setq params (list :scope (oref transient--prefix scope))))
+ (transient--transient-map
+ ;; Invoked as a ":transient-non-suffix 'transient--do-{stay,call}"
+ ;; of an outer prefix. Unlike the usual `transient--do-replace',
+ ;; these predicates fail to clean up after the outer prefix.
+ (transient--pop-keymap 'transient--transient-map)
+ (transient--pop-keymap 'transient--redisplay-map))
((not (or layout ; resuming parent/suspended prefix
transient-current-command)) ; entering child prefix
(transient--stack-zap)) ; replace suspended prefix, if any
- [elpa] externals/transient 7811dcf 06/18: Add /docs/*.info to .gitignore, (continued)
- [elpa] externals/transient 7811dcf 06/18: Add /docs/*.info to .gitignore, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient 8ad5fb8 07/18: Remove async-bytecomp kludge, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient 7065e1c 09/18: manual: Various small improvements, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient 4fc9aa5 10/18: manual: Fix small typo, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient d48f245 12/18: transient--pre-exit: Don't log clearing of minibuffer, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient 691d10f 11/18: Fix doc-string typo, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient e91ad31 14/18: transient--debug: Show this-command-keys, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient f086cb6 04/18: transient--insert-suffix: Allow same key with different predicates, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient eb39c96 13/18: transient--debug: Always show symbol representing command, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient d85eb79 15/18: transient-read-directory: Pass read value through file-local-name, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient 48238bf 16/18: Allow invoking arbitrary prefixes as non-suffixes,
Jonas Bernoulli <=
- [elpa] externals/transient 48335f8 17/18: transient-status: Prevent use while minibuffer is active, Jonas Bernoulli, 2021/02/27
- [elpa] externals/transient 9ca983b 18/18: Release version 0.3.0, Jonas Bernoulli, 2021/02/27