summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-08-06 02:36:22 +0300
committerJuri Linkov <juri@linkov.net>2021-08-06 02:36:22 +0300
commit18d7562e91d137b4e1efbd6c416f225af6efad3f (patch)
tree44bfeacc8de2cb7a5f70ecb04cf314a4bbadb3a8 /lisp/minibuffer.el
parent4ec10c80abfc985efa9707e5129b4cb5612d6582 (diff)
downloademacs-18d7562e91d137b4e1efbd6c416f225af6efad3f.tar.gz
emacs-18d7562e91d137b4e1efbd6c416f225af6efad3f.tar.bz2
emacs-18d7562e91d137b4e1efbd6c416f225af6efad3f.zip
Add function minibuffer-restore-windows (bug#45072)
* lisp/minibuffer.el (minibuffer-restore-windows): New function that removes the completions buffer. Add it to minibuffer-exit-hook. * src/minibuf.c (read-minibuffer-restore-windows): Mention minibuffer-restore-windows.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3751ba80e0a..3258e1ec8da 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2328,6 +2328,16 @@ variables.")
(setq deactivate-mark nil)
(throw 'exit nil))
+(defun minibuffer-restore-windows ()
+ "Restore some windows on exit from minibuffer.
+When `read-minibuffer-restore-windows' is nil, then this function
+added to `minibuffer-exit-hook' will remove at least the window
+with the *Completions* buffer."
+ (unless read-minibuffer-restore-windows
+ (minibuffer-hide-completions)))
+
+(add-hook 'minibuffer-exit-hook 'minibuffer-restore-windows)
+
(defun minibuffer-quit-recursive-edit ()
"Quit the command that requested this recursive edit without error.
Like `abort-recursive-edit' without aborting keyboard macro