Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
link0ff committed Aug 5, 2021
1 parent 4ec10c8 commit 18d7562
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions etc/NEWS
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions lisp/minibuffer.el
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/minibuf.c
Expand Up @@ -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);
Expand Down

0 comments on commit 18d7562

Please sign in to comment.