[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 784887b781 14/41: Account for t as transient-
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 784887b781 14/41: Account for t as transient-suffix for nested prefixes |
Date: |
Sun, 12 Nov 2023 20:04:08 -0500 (EST) |
branch: externals/transient
commit 784887b78160e0c820b44924d12b2e2e0bf90ef0
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Account for t as transient-suffix for nested prefixes
When the prefix's `transient-suffix' is t, and the current prefix
is a sub-prefix, then suffixes have to use `transient--do-return',
to exit the sub-prefix but not the outer prefix.
Previously this only worked if the value of that slot was that
predicate itself, but that must be avoided because it is only
suitable for suffixes, not infixes and sub-prefixes.
---
lisp/transient.el | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 1e83c33eef..40ea33414d 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1756,8 +1756,9 @@ of the corresponding object."
map))
(defun transient--make-predicate-map ()
- (let ((default (oref transient--prefix transient-suffix))
- (map (make-sparse-keymap)))
+ (let* ((default (oref transient--prefix transient-suffix))
+ (return (eq default t))
+ (map (make-sparse-keymap)))
(set-keymap-parent map transient-predicate-map)
(when (memq (oref transient--prefix transient-non-suffix)
'(nil transient--do-warn transient--do-noop))
@@ -1772,24 +1773,26 @@ of the corresponding object."
(define-key map (vector cmd) #'transient--do-warn-inapt))
((slot-boundp obj 'transient)
(define-key map (vector cmd)
- (pcase (list kind (oref obj transient))
- ('(prefix t) #'transient--do-recurse)
- ('(prefix nil) #'transient--do-replace)
- ('(infix t) #'transient--do-stay)
- ('(suffix t) #'transient--do-call)
- (`(,_ nil) #'transient--do-exit)
- (`(,_ ,do) do))))
+ (pcase (list kind (oref obj transient) return)
+ (`(prefix t ,_) #'transient--do-recurse)
+ (`(prefix nil ,_) #'transient--do-replace)
+ (`(infix t ,_) #'transient--do-stay)
+ (`(suffix t ,_) #'transient--do-call)
+ ('(suffix nil t) #'transient--do-return)
+ (`(,_ nil ,_) #'transient--do-exit)
+ (`(,_ ,do ,_) do))))
((not (lookup-key transient-predicate-map (vector cmd)))
(define-key map (vector cmd)
- (pcase (list kind default)
- (`(prefix ,(or 'transient--do-stay 'transient--do-call))
+ (pcase (list kind default return)
+ (`(prefix ,(or 'transient--do-stay 'transient--do-call) ,_)
#'transient--do-recurse)
- ('(prefix t) #'transient--do-recurse)
- (`(prefix ,_) #'transient--do-replace)
- (`(infix ,_) #'transient--do-stay)
- ('(suffix t) #'transient--do-call)
- ('(suffix nil) #'transient--do-exit)
- (`(suffix ,do) do)))))))
+ (`(prefix t ,_) #'transient--do-recurse)
+ (`(prefix ,_ ,_) #'transient--do-replace)
+ (`(infix ,_ ,_) #'transient--do-stay)
+ (`(suffix t ,_) #'transient--do-call)
+ ('(suffix nil t) #'transient--do-return)
+ (`(suffix nil ,_) #'transient--do-exit)
+ (`(suffix ,do ,_) do)))))))
map))
(defun transient--make-redisplay-map ()
@@ -2547,7 +2550,7 @@ If there is no parent prefix, then just call the command."
(when (and (slot-boundp suffix-obj 'transient)
(memq (oref suffix-obj transient)
(list t #'transient--do-recurse)))
- (oset prefix-obj transient-suffix 'transient--do-return))))))
+ (oset prefix-obj transient-suffix t))))))
(defun transient--do-replace ()
"Call the transient prefix command, replacing the active transient."
- [elpa] externals/transient 425003a44b 22/41: transient-infix-set(argument): Limit to other arguments, (continued)
- [elpa] externals/transient 425003a44b 22/41: transient-infix-set(argument): Limit to other arguments, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8d8df0f038 20/41: transient-infix-set(argument): Cosmetics, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 9d9e931996 25/41: transient--shadowed-buffer: Renamed from transient--current-buffer, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8e15a29b59 31/41: transient-format-description: Support function as value of face slot, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 533578b6b2 32/41: transient-information: Use a space as the fake key, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 59d8c0342a 18/41: transient--unset-incompatible: Remove unnecessary variable, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient ed5bd6fdc3 23/41: transient-infix-set(argument): Fix disabling incompatible options, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient bad91f79ec 29/41: transient-with-shadowed-buffer: Move definition, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient cf32cf6f98 39/41: transient--get-face: Favor face over function, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 4b9d831d28 10/41: transient--make-predicate-map: Drop obsolete condition, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 784887b781 14/41: Account for t as transient-suffix for nested prefixes,
Jonas Bernoulli <=
- [elpa] externals/transient 2eb214a6ec 24/41: transient-infix-set(argument): Also disable based on concrete value, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 94661e0ccd 34/41: transient--do-replace: Replace with two variants, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 9617b6c77c 35/41: transient--make-predicate-map: Support shorthands, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 3a2b936a67 36/41: Fix highlighting infix for which user input is being read, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 222c2bfbeb 38/41: transient--get-face: New function, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 02607dd9d9 04/41: manual: Move comparisons to wiki, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 0677e2c3d8 26/41: transient-format-description: Operate in transient--shadowed-buffer, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient b4a2963636 33/41: transient-format(around:suffix): Update for transient-information, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient d44c4fce39 40/41: transient--get-face: Use for inapt-face, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient eaf062a921 11/41: transient--make-predicate-map: Refactor, Jonas Bernoulli, 2023/11/12