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

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

[elpa] externals/transient a19faa1c71 6/6: Return to outer prefix when m


From: Stefan Monnier
Subject: [elpa] externals/transient a19faa1c71 6/6: Return to outer prefix when minibuffer is aborted for sub-prefix
Date: Wed, 19 Jan 2022 18:53:38 -0500 (EST)

branch: externals/transient
commit a19faa1c71428e1f5b2bb548b966e9f9b1a9eca2
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Return to outer prefix when minibuffer is aborted for sub-prefix
    
    When a suffix is transient and uses the minibuffer, and the user
    aborts that, then the transient remains open.  If the suffix is
    a prefix itself, then that did not happen before this commit.
---
 lisp/transient.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 6542ce44f6..db5d0f828e 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2111,7 +2111,7 @@ value.  Otherwise return CHILDREN as is."
   (let ((depth (minibuffer-depth))
         (command this-command)
         (delayed (if transient--exitp
-                     #'transient--post-exit
+                     (apply-partially #'transient--post-exit this-command)
                    #'transient--resume-override))
         post-command abort-minibuffer)
     (unless abort-only
@@ -2160,7 +2160,7 @@ value.  Otherwise return CHILDREN as is."
           (transient--push-keymap 'transient--redisplay-map)))
       (transient--redisplay)))))
 
-(defun transient--post-exit ()
+(defun transient--post-exit (&optional command)
   (transient--debug 'post-exit)
   (unless (and (eq transient--exitp 'replace)
                (or transient--prefix
@@ -2169,7 +2169,14 @@ value.  Otherwise return CHILDREN as is."
                    ;; or it is prevented from doing so because it
                    ;; uses the minibuffer and the user aborted
                    ;; that.
-                   (prog1 nil (transient--stack-zap))))
+                   (prog1 nil
+                     (if (with-demoted-errors "transient--post-exit: %S"
+                           (oref (transient-suffix-object command) transient))
+                         ;; This sub-prefix is a transient suffix;
+                         ;; go back to outer prefix, by calling
+                         ;; `transient--stack-pop' further down.
+                         (setq transient--exitp nil)
+                       (transient--stack-zap)))))
     (remove-hook 'pre-command-hook  #'transient--pre-command)
     (remove-hook 'post-command-hook #'transient--post-command))
   (setq transient-current-prefix nil)



reply via email to

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