[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 76b77e01ac 09/38: magit--{pre, post}-command:
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 76b77e01ac 09/38: magit--{pre, post}-command: Add emergency exits |
Date: |
Tue, 11 Jan 2022 05:37:44 -0500 (EST) |
branch: externals/transient
commit 76b77e01aca43f13bc94f9479687bfa84e7034eb
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit--{pre,post}-command: Add emergency exits
---
lisp/transient.el | 98 ++++++++++++++++++++++++++++---------------------------
1 file changed, 50 insertions(+), 48 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 4935e2b587..2d8f86d686 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1920,41 +1920,42 @@ value. Otherwise return CHILDREN as is."
(defun transient--pre-command ()
(transient--debug 'pre-command)
- (cond
- ((memq this-command '(transient-update transient-quit-seq))
- (transient--pop-keymap 'transient--redisplay-map))
- ((and transient--helpp
- (not (memq this-command '(transient-quit-one
- transient-quit-all))))
+ (transient--with-emergency-exit
(cond
- ((transient-help)
- (transient--do-suspend)
- (setq this-command 'transient-suspend)
- (transient--pre-exit))
- ((not (transient--edebug-command-p))
- (setq this-command 'transient-undefined))))
- ((and transient--editp
- (transient-suffix-object)
- (not (memq this-command '(transient-quit-one
- transient-quit-all
- transient-help))))
- (setq this-command 'transient-set-level))
- (t
- (setq transient--exitp nil)
- (when (eq (if-let ((fn (transient--get-predicate-for
- this-original-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)
- transient--exit)
- (transient--pre-exit)))))
+ ((memq this-command '(transient-update transient-quit-seq))
+ (transient--pop-keymap 'transient--redisplay-map))
+ ((and transient--helpp
+ (not (memq this-command '(transient-quit-one
+ transient-quit-all))))
+ (cond
+ ((transient-help)
+ (transient--do-suspend)
+ (setq this-command 'transient-suspend)
+ (transient--pre-exit))
+ ((not (transient--edebug-command-p))
+ (setq this-command 'transient-undefined))))
+ ((and transient--editp
+ (transient-suffix-object)
+ (not (memq this-command '(transient-quit-one
+ transient-quit-all
+ transient-help))))
+ (setq this-command 'transient-set-level))
+ (t
+ (setq transient--exitp nil)
+ (when (eq (if-let ((fn (transient--get-predicate-for
+ this-original-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)
+ transient--exit)
+ (transient--pre-exit))))))
(defun transient--get-predicate-for (cmd)
(or (lookup-key transient--predicate-map
@@ -2083,20 +2084,21 @@ value. Otherwise return CHILDREN as is."
(defun transient--post-command ()
(transient--debug 'post-command)
- (cond
- ((and (eq (this-command-keys-vector) [])
- (= (minibuffer-depth)
- (1+ transient--minibuffer-depth)))
- (transient--suspend-override)
- (transient--delay-post-command))
- (transient--exitp
- (transient--post-exit))
- ((eq this-command (oref transient--prefix command)))
- (t
- (transient--pop-keymap 'transient--redisplay-map)
- (setq transient--redisplay-map (transient--make-redisplay-map))
- (transient--push-keymap 'transient--redisplay-map)
- (transient--redisplay))))
+ (transient--with-emergency-exit
+ (cond
+ ((and (eq (this-command-keys-vector) [])
+ (= (minibuffer-depth)
+ (1+ transient--minibuffer-depth)))
+ (transient--suspend-override)
+ (transient--delay-post-command))
+ (transient--exitp
+ (transient--post-exit))
+ ((eq this-command (oref transient--prefix command)))
+ (t
+ (transient--pop-keymap 'transient--redisplay-map)
+ (setq transient--redisplay-map (transient--make-redisplay-map))
+ (transient--push-keymap 'transient--redisplay-map)
+ (transient--redisplay)))))
(defun transient--post-exit ()
(transient--debug 'post-exit)
- [elpa] externals/transient e90f7a165e 16/38: Add support for returning from a sub-prefix to the parent prefix, (continued)
- [elpa] externals/transient e90f7a165e 16/38: Add support for returning from a sub-prefix to the parent prefix, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 714e348296 18/38: No longer always suspend when handle-switch-frame is called, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient c19ff84355 19/38: manual: Rearrange and group options, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 5762bd9a06 22/38: transient-hide-during-minibuffer-read: New option, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 8d8ed1965f 26/38: Hide infix commands from execute-extended-command, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 6103f168aa 28/38: transient--describe-function: Deal with anonymous infix arguments, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 2c9cef1f5a 33/38: Bump copyright years, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient e77d16dd02 03/38: transient--post-command: Avoid needlessly recreating redisplay map, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 79c999d263 06/38: transient--post-exit: New function, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 2e33f96cf0 07/38: transient--post-command: Cosmetics, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 76b77e01ac 09/38: magit--{pre, post}-command: Add emergency exits,
Jonas Bernoulli <=
- [elpa] externals/transient 7b8a7d718a 08/38: Use a more targeted approach to suspending transient override, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 09b436fad0 10/38: transient--debug: Ignore error in transient--suffix-symbol, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient f2e0dfcc4b 11/38: transient--get-predicate-for: Ignore error in transient--suffix-symbol, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 3c78b10f52 14/38: transient--redisplay: Don't redisplay during mouse-drag-region, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 4a36b1d922 17/38: Interpret t and nil for sub-prefixes in define-transient-prefix, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 1cdadfddf8 21/38: manual: Use source block, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 777a84d26b 20/38: manual: Document all options, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 51585b8dd7 25/38: transient-reset: New command, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient 6c9ae1f46a 27/38: manual: Replace some inaccurate information, Jonas Bernoulli, 2022/01/11
- [elpa] externals/transient de5a325616 30/38: Re-align debug declarations, Jonas Bernoulli, 2022/01/11