[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 004ca25946 06/26: Move definition of function
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 004ca25946 06/26: Move definition of functions that handle pre-commands |
Date: |
Sun, 26 Nov 2023 19:41:59 -0500 (EST) |
branch: externals/transient
commit 004ca259461eb988a7fd5ae71dd899c43542bc4b
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Move definition of functions that handle pre-commands
---
lisp/transient.el | 60 +++++++++++++++++++++++++++----------------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 3c735700ad..f818342e5e 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2176,36 +2176,6 @@ value. Otherwise return CHILDREN as is."
(when exitp
(transient--pre-exit)))))))
-(defun transient--do-pre-command ()
- (if-let ((fn (transient--get-predicate-for this-command)))
- (let ((action (funcall fn)))
- (when (eq action transient--exit)
- (setq transient--exitp (or transient--exitp t)))
- action)
- (if (let ((keys (this-command-keys-vector)))
- (eq (aref keys (1- (length keys))) ?\C-g))
- (setq this-command 'transient-noop)
- (unless (transient--edebug-command-p)
- (setq this-command 'transient-undefined)))
- transient--stay))
-
-(defun transient--get-predicate-for (cmd &optional suffix-only)
- (or (ignore-errors
- (lookup-key transient--predicate-map (vector cmd)))
- (and (not suffix-only)
- (let ((pred (transient--resolve-pre-command
- (oref transient--prefix transient-non-suffix))))
- (pcase pred
- ('t #'transient--do-stay)
- ('nil #'transient--do-warn)
- (_ pred))))))
-
-(defun transient--resolve-pre-command (pre)
- (cond ((booleanp pre) pre)
- ((string-match-p "--do-" (symbol-name pre)) pre)
- ((let ((sym (intern (format "transient--do-%s" pre))))
- (if (functionp sym) sym pre)))))
-
(defun transient--pre-exit ()
(transient--debug 'pre-exit)
(transient--delete-window)
@@ -2534,6 +2504,36 @@ nil) then do nothing."
;;; Pre-Commands
+(defun transient--do-pre-command ()
+ (if-let ((fn (transient--get-predicate-for this-command)))
+ (let ((action (funcall fn)))
+ (when (eq action transient--exit)
+ (setq transient--exitp (or transient--exitp t)))
+ action)
+ (if (let ((keys (this-command-keys-vector)))
+ (eq (aref keys (1- (length keys))) ?\C-g))
+ (setq this-command 'transient-noop)
+ (unless (transient--edebug-command-p)
+ (setq this-command 'transient-undefined)))
+ transient--stay))
+
+(defun transient--get-predicate-for (cmd &optional suffix-only)
+ (or (ignore-errors
+ (lookup-key transient--predicate-map (vector cmd)))
+ (and (not suffix-only)
+ (let ((pred (transient--resolve-pre-command
+ (oref transient--prefix transient-non-suffix))))
+ (pcase pred
+ ('t #'transient--do-stay)
+ ('nil #'transient--do-warn)
+ (_ pred))))))
+
+(defun transient--resolve-pre-command (pre)
+ (cond ((booleanp pre) pre)
+ ((string-match-p "--do-" (symbol-name pre)) pre)
+ ((let ((sym (intern (format "transient--do-%s" pre))))
+ (if (functionp sym) sym pre)))))
+
(defun transient--do-stay ()
"Call the command without exporting variables and stay transient."
transient--stay)
- [elpa] externals/transient updated (57bb749f98 -> af6eb31054), Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 7d9d639cdf 01/26: make: Only append newline to transient.texi if missing, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient ff496fe5ad 04/26: manual: Use "documentation string" instead of "doc string", Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 44792c2bf9 03/26: manual: Copy-edit, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 163d0a83f7 02/26: manual: Regenerate texi file, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 004ca25946 06/26: Move definition of functions that handle pre-commands,
Jonas Bernoulli <=
- [elpa] externals/transient f23f51e24e 07/26: Rename transient--{do => call}-pre-command, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 37307c1b8c 05/26: transient-prefix-object: New function, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 4c1cda9984 08/26: Rename transient-get-{predicate-for => pre-command}, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient f4b4dd42b9 14/26: Add transient--do-leave's missing color setting, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 0509c90e53 11/26: transient--key-face: New function, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 05754d1576 13/26: Rearrange pre-command color settings, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 98d8cf8016 15/26: Fix transient--do-quit-one's color setting, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 9c00fae158 10/26: transient--add-face: Move definition, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient b1951a87b5 09/26: transient--resolve-pre-command: Optionally resolve boolean as well, Jonas Bernoulli, 2023/11/26
- [elpa] externals/transient 9a21467706 12/26: transient--separator-line: New function, Jonas Bernoulli, 2023/11/26