emacs-diffs
[Top][All Lists]
Advanced

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

master 18d7562: Add function minibuffer-restore-windows (bug#45072)


From: Juri Linkov
Subject: master 18d7562: Add function minibuffer-restore-windows (bug#45072)
Date: Thu, 5 Aug 2021 19:36:45 -0400 (EDT)

branch: master
commit 18d7562e91d137b4e1efbd6c416f225af6efad3f
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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.
---
 etc/NEWS           |  2 ++
 lisp/minibuffer.el | 10 ++++++++++
 src/minibuf.c      |  7 +++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5276a09..1dd50a3 100644
--- 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.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 3751ba8..3258e1e 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
diff --git a/src/minibuf.c b/src/minibuf.c
index 3ee0dca..a054f0e 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -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);



reply via email to

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