emacs-diffs
[Top][All Lists]
Advanced

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

master 69d3a6c: Allow exit-minibuffer to be called from Lisp code. Fixes


From: Alan Mackenzie
Subject: master 69d3a6c: Allow exit-minibuffer to be called from Lisp code. Fixes bug #46373
Date: Tue, 9 Feb 2021 04:42:25 -0500 (EST)

branch: master
commit 69d3a6c90f9bafdc4742097d1828ed7204aa12e0
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    Allow exit-minibuffer to be called from Lisp code.  Fixes bug #46373
    
    * lisp/minibuffer.el (exit-minibuffer): Throw the error "Not in most nested
    minibuffer" only when the current buffer is a minibuffer (thus the command
    came directly from a key binding).
    
    * doc/lispref/minibuf.texi (Minibuffer Commands): Change the documentation
    accordingly.
---
 doc/lispref/minibuf.texi | 2 +-
 lisp/minibuffer.el       | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 185d355..b60775d 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -2393,7 +2393,7 @@ minibuffer.
 @deffn Command exit-minibuffer
 This command exits the active minibuffer.  It is normally bound to
 keys in minibuffer local keymaps.  The command throws an error if the
-current buffer is not the active minibuffer.
+current buffer is a minibuffer, but not the active minibuffer.
 @end deffn
 
 @deffn Command self-insert-and-exit
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 03cc70c..a899a94 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2116,13 +2116,15 @@ variables.")
 (defun exit-minibuffer ()
   "Terminate this minibuffer argument."
   (interactive)
+  (when (or
+         (innermost-minibuffer-p)
+         (not (minibufferp)))
   ;; If the command that uses this has made modifications in the minibuffer,
   ;; we don't want them to cause deactivation of the mark in the original
   ;; buffer.
   ;; A better solution would be to make deactivate-mark buffer-local
   ;; (or to turn it into a list of buffers, ...), but in the mean time,
   ;; this should do the trick in most cases.
-  (when (innermost-minibuffer-p)
     (setq deactivate-mark nil)
     (throw 'exit nil))
   (error "%s" "Not in most nested minibuffer"))



reply via email to

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