summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin rudalics <rudalics@gmx.at>2021-08-04 08:48:18 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-08-04 08:48:18 +0200
commit51583a0f9f75950933a342a09ea3d317a528581e (patch)
treefb25d433334158f884c7ec545829f85763a06286
parentbee3e51550174047c73a1e942c16c8d45e2db1b8 (diff)
downloademacs-51583a0f9f75950933a342a09ea3d317a528581e.tar.gz
emacs-51583a0f9f75950933a342a09ea3d317a528581e.tar.bz2
emacs-51583a0f9f75950933a342a09ea3d317a528581e.zip
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'.
-rw-r--r--doc/lispref/minibuf.texi12
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/cus-start.el1
-rw-r--r--src/minibuf.c18
4 files changed, 31 insertions, 3 deletions
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 196dd990767..d54c654562f 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -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
diff --git a/etc/NEWS b/etc/NEWS
index 86aeea69ca1..18cca8b4ab3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -179,6 +179,9 @@ behavior, which mixed these two, can be approximated by customizing
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
choosing a group, or clicking a button in the "*Help*" buffers when
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 7df70d704ef..27b98f2d809 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -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)
diff --git a/src/minibuf.c b/src/minibuf.c
index 0f4349e70b8..3ee0dca5e05 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -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);