emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/transient 76b77e01ac 328/366: magit--{pre, post}-comman


From: Jonas Bernoulli
Subject: [elpa] externals/transient 76b77e01ac 328/366: magit--{pre, post}-command: Add emergency exits
Date: Tue, 25 Jan 2022 18:54:52 -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]