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

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

[elpa] externals/transient dd9c40adc3 180/366: transient-setup: Handle e


From: Jonas Bernoulli
Subject: [elpa] externals/transient dd9c40adc3 180/366: transient-setup: Handle edge-case
Date: Tue, 25 Jan 2022 18:54:39 -0500 (EST)

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

    transient-setup: Handle edge-case
    
    When the minibuffer is active on behalf of a suffix command, then we
    cannot completely prevent the user from invoking commands that they
    should not invoke at this time (i.e. they can use recursive editing,
    which does not play well with transient prefixes) because we have to
    allow arbitrary commands as we cannot know whether any such command
    is something that aids during minibuffer completion.
    
    When the user takes the opportunity to invoke another prefix at this
    time, then this leads to events from our minibuffer and setup hooks
    being firing in an unintended order and that leads to Emacs entering
    an inconsistent transient state.
    
    Since we wouldn't want the user to move away from the minibuffer even
    if doing so did not lead to this issue, we simply detect and disallow
    entering a transient prefix after having done that.
    
    Closes the variant of #64 that was reported by @bricewge.
---
 lisp/transient.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/transient.el b/lisp/transient.el
index 950822b917..f5cd8386d3 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1571,6 +1571,9 @@ be nil and PARAMS may be (but usually is not) used to set 
e.g. the
 This function is also called internally in which case LAYOUT and
 EDIT may be non-nil."
   (transient--debug 'setup)
+  (when (and (>= (minibuffer-depth) 1) transient--prefix)
+    (error "Cannot invoke %s while minibuffer is active %s"
+           this-command "on behalf of another prefix command"))
   (cond
    ((not name)
     ;; Switching between regular and edit mode.



reply via email to

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