]> git.eshelyaron.com Git - emacs.git/commitdiff
Add function minibuffer-restore-windows (bug#45072)
authorJuri Linkov <juri@linkov.net>
Thu, 5 Aug 2021 23:36:22 +0000 (02:36 +0300)
committerJuri Linkov <juri@linkov.net>
Thu, 5 Aug 2021 23:36:22 +0000 (02:36 +0300)
* 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.

etc/NEWS
lisp/minibuffer.el
src/minibuf.c

index 5276a0981e90b56c6693e9a6d8b03eac1df2f609..1dd50a39bac45e07c24625a97816970db8ddf9e7 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -180,6 +180,8 @@ nor t.
 
 +++
 ** New user option 'read-minibuffer-restore-windows'.
+When customized to nil, it uses 'minibuffer-restore-windows' in
+'minibuffer-exit-hook' to remove only the *Completions* window.
 
 +++
 ** New system for displaying documentation for groups of functions.
index 3751ba80e0ab54a85a45e172cc84a8690ae27305..3258e1ec8da2657c22c5724774073cd3d9bf92dd 100644 (file)
@@ -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
index 3ee0dca5e055ee3980e5a3d5b76a3aeff7c7d23e..a054f0e20dc14e4e5f95b7462cae5953a89e8be9 100644 (file)
@@ -2535,8 +2535,11 @@ instead. */);
 If this is non-nil (the default), reading input with the minibuffer will
 restore, on exit, the window configurations of the frame where the
 minibuffer was entered from and, if it is different, the frame that owns
-the associated minibuffer window.  If this is nil, no such restorations
-are done.  */);
+the associated minibuffer window.
+
+If this is nil, no such restorations are done.
+But still `minibuffer-restore-windows' in `minibuffer-exit-hook'
+will remove the window with the *Completions* buffer.  */);
   read_minibuffer_restore_windows = true;
 
   defsubr (&Sactive_minibuffer_window);