Add new user option 'read-minibuffer-restore-windows'

* doc/lispref/minibuf.texi (Text from Minibuffer): Document it
(bug#45072).

* lisp/cus-start.el (standard): Add.

* src/minibuf.c (syms_of_minibuf): New variable
'read-minibuffer-restore-windows'.
This commit is contained in:
martin rudalics 2021-08-04 08:48:18 +02:00 committed by Lars Ingebrigtsen
parent bee3e51550
commit 51583a0f9f
4 changed files with 31 additions and 3 deletions

View file

@ -469,6 +469,18 @@ If @var{default} is a non-@code{nil} list, the first element of the
list is used in the prompt.
@end defun
@defvar read-minibuffer-restore-windows
If this option is non-@code{nil} (the default), getting input from 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 minibuffer window. This means that if, for example, a
user splits a window while getting input from the minibuffer on the same
frame, that split will be undone when exiting the minibuffer.
If this option is @code{nil}, no such restorations are done. Hence, the
window split mentioned above will persist after exiting the minibuffer.
@end defvar
@node Object from Minibuffer
@section Reading Lisp Objects with the Minibuffer
@cindex minibuffer input, reading lisp objects

View file

@ -178,6 +178,9 @@ behavior, which mixed these two, can be approximated by customizing
'minibuffer-follows-selected-frame' to a value which is neither nil
nor t.
+++
** New user option 'read-minibuffer-restore-windows'.
+++
** New system for displaying documentation for groups of functions.
This can either be used by saying 'M-x shortdoc-display-group' and

View file

@ -431,6 +431,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
"21.1"
:set minibuffer-prompt-properties--setter)
(minibuffer-auto-raise minibuffer boolean)
(read-minibuffer-restore-windows boolean "28.1")
;; options property set at end
(read-buffer-function minibuffer
(choice (const nil)

View file

@ -689,12 +689,15 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
call1 (Qpush_window_buffer_onto_prev, minibuf_window);
record_unwind_protect_void (minibuffer_unwind);
record_unwind_protect (restore_window_configuration,
list3 (Fcurrent_window_configuration (Qnil), Qt, Qt));
if (read_minibuffer_restore_windows)
record_unwind_protect (restore_window_configuration,
list3 (Fcurrent_window_configuration (Qnil),
Qt, Qt));
/* If the minibuffer window is on a different frame, save that
frame's configuration too. */
if (!EQ (mini_frame, selected_frame))
if (read_minibuffer_restore_windows &&
!EQ (mini_frame, selected_frame))
record_unwind_protect (restore_window_configuration,
list3 (Fcurrent_window_configuration (mini_frame),
Qnil, Qt));
@ -2527,6 +2530,15 @@ for instance when running a headless Emacs server. Functions like
instead. */);
inhibit_interaction = 0;
DEFVAR_BOOL ("read-minibuffer-restore-windows", read_minibuffer_restore_windows,
doc: /* Non-nil means restore window configurations on exit from minibuffer.
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. */);
read_minibuffer_restore_windows = true;
defsubr (&Sactive_minibuffer_window);
defsubr (&Sset_minibuffer_window);
defsubr (&Sread_from_minibuffer);