[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient eaf062a921 11/41: transient--make-predicate-m
|
From: |
Jonas Bernoulli |
|
Subject: |
[elpa] externals/transient eaf062a921 11/41: transient--make-predicate-map: Refactor |
|
Date: |
Sun, 12 Nov 2023 20:04:07 -0500 (EST) |
branch: externals/transient
commit eaf062a92194b07ef0e8ce9e4c6d1f1cd75a728a
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient--make-predicate-map: Refactor
---
lisp/transient.el | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index c9e6d4267f..442cdcd3cd 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1756,34 +1756,35 @@ of the corresponding object."
map))
(defun transient--make-predicate-map ()
- (let ((map (make-sparse-keymap)))
+ (let ((default (oref transient--prefix transient-suffix))
+ (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))
(define-key map [handle-switch-frame] #'transient--do-suspend))
(dolist (obj transient--suffixes)
(let* ((cmd (oref obj command))
- (sub-prefix (and (get cmd 'transient--prefix) t)))
+ (kind (cond ((get cmd 'transient--prefix) 'prefix)
+ ((cl-typep obj 'transient-infix) 'infix)
+ (t 'suffix))))
(cond
((oref obj inapt)
(define-key map (vector cmd) #'transient--do-warn-inapt))
((slot-boundp obj 'transient)
(define-key map (vector cmd)
- (let ((do (oref obj transient)))
- (pcase (list do sub-prefix)
- ('(t t) #'transient--do-recurse)
- ('(t nil) (if (cl-typep obj 'transient-infix)
- #'transient--do-stay
- #'transient--do-call))
- ('(nil t) #'transient--do-replace)
- ('(nil nil) #'transient--do-exit)
- (_ do)))))
+ (pcase (list kind (oref obj transient))
+ ('(prefix t) #'transient--do-recurse)
+ ('(infix t) #'transient--do-stay)
+ ('(suffix t) #'transient--do-call)
+ ('(prefix nil) #'transient--do-replace)
+ (`(,_ nil) #'transient--do-exit)
+ (`(,_ ,do) do))))
((not (lookup-key transient-predicate-map (vector cmd)))
(define-key map (vector cmd)
- (if sub-prefix
- #'transient--do-replace
- (or (oref transient--prefix transient-suffix)
- #'transient--do-exit)))))))
+ (pcase (list kind default)
+ (`(prefix ,_) #'transient--do-replace)
+ (`(,_ nil) #'transient--do-exit)
+ (`(,_ ,do) do)))))))
map))
(defun transient--make-redisplay-map ()
- [elpa] externals/transient 784887b781 14/41: Account for t as transient-suffix for nested prefixes, (continued)
- [elpa] externals/transient 784887b781 14/41: Account for t as transient-suffix for nested prefixes, Jonas Bernoulli, 2023/11/12
- [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 <=
- [elpa] externals/transient 5ad5b627f6 15/41: transient--setup-recursion: When initiated by outer transient-suffix, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 2b7219cf6a 28/41: transient--current-buffer: Fix obsolete variable alias, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 0a0ba1aa90 01/41: transient--do-leave: Actually behave as documented, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 8bfd92993f 17/41: manual: Update "Transient State" section, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 0dda40e8b6 27/41: transient-with-shadowed-buffer: New macro, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient b1d1c36966 37/41: Prevent temporary faces from leaking back into objects, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient ef02586712 03/41: transient--invalid: Remove message about former heisenbug, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient a2ff9bc5a3 16/41: transient--stack-push: Preserve value of transient-suffix slot, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 71399d21c5 30/41: transient-format: No longer apply face for inapt bindings here, Jonas Bernoulli, 2023/11/12
- [elpa] externals/transient 3cd1de1695 41/41: Make shadowed buffer current around forge-format{, -description}, Jonas Bernoulli, 2023/11/12