--- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -458,6 +458,19 @@ Text from Minibuffer 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 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -500,19 +500,21 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, record_unwind_protect_void (choose_minibuf_frame); - record_unwind_protect (restore_window_configuration, - Fcons (Qt, Fcurrent_window_configuration (Qnil))); + if (read_minibuffer_restore_windows) + record_unwind_protect (restore_window_configuration, + Fcons (Qt, Fcurrent_window_configuration (Qnil))); /* If the minibuffer window is on a different frame, save that frame's configuration too. */ mini_frame = WINDOW_FRAME (XWINDOW (minibuf_window)); - if (!EQ (mini_frame, selected_frame)) + + if (read_minibuffer_restore_windows && !EQ (mini_frame, selected_frame)) record_unwind_protect (restore_window_configuration, Fcons (/* Arrange for the frame later to be - switched back to the calling - frame. */ - Qnil, - Fcurrent_window_configuration (mini_frame))); + switched back to the calling + frame. */ + Qnil, + Fcurrent_window_configuration (mini_frame))); /* If the minibuffer is on an iconified or invisible frame, make it visible now. */ @@ -2186,6 +2188,15 @@ syms_of_minibuf (void) uses to hide passwords. */); Vread_hide_char = Qnil; + 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);