all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>, Lars Ingebrigtsen <larsi@gnus.org>
Cc: bugs@gnu.support, 45072@debbugs.gnu.org
Subject: bug#45072: 28.0.50; Emacs switches other buffer back uncontrollably, if other window's buffer is changed by user during minibuffer editing
Date: Wed, 9 Dec 2020 10:33:26 +0100	[thread overview]
Message-ID: <7a7c3ef0-619d-cd76-a4e4-040009e33d75@gmx.at> (raw)
In-Reply-To: <83h7ow70ty.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

 > Yes.  But maybe read-from-minibuffer-restore-windows would be even
 > better.

And `read-minibuffer-restore-windows' would be even shorter.  Attached.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: read-minibuffer-restore-windows.diff --]
[-- Type: text/x-patch; name="read-minibuffer-restore-windows.diff", Size: 3045 bytes --]

--- 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);

  reply	other threads:[~2020-12-09  9:33 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06 14:07 bug#45072: 28.0.50; Emacs switches other buffer back uncontrollably, if other window's buffer is changed by user during minibuffer editing Jean Louis
2020-12-07 16:10 ` Lars Ingebrigtsen
2020-12-07 16:42   ` Jean Louis
2020-12-07 17:20     ` Eli Zaretskii
2020-12-07 18:49       ` Jean Louis
2020-12-07 19:27         ` Eli Zaretskii
2020-12-07 19:45           ` Jean Louis
2020-12-08  8:09           ` martin rudalics
2020-12-08 14:09             ` Lars Ingebrigtsen
2020-12-08 14:18               ` Jean Louis
2020-12-08 14:47               ` martin rudalics
2020-12-08 14:58                 ` Jean Louis
2020-12-08 16:08                   ` Eli Zaretskii
2020-12-08 16:14                     ` Jean Louis
2020-12-08 15:51               ` Eli Zaretskii
2020-12-09  9:33                 ` martin rudalics [this message]
2021-08-03  7:57                   ` Juri Linkov
2021-08-04  6:52                     ` Lars Ingebrigtsen
2021-08-04  8:39                       ` Juri Linkov
2021-08-04  8:56                         ` Lars Ingebrigtsen
2021-08-04 20:17                           ` Juri Linkov
2021-08-05 10:55                             ` Lars Ingebrigtsen
2021-08-05 23:36                               ` Juri Linkov
2020-12-08 19:15             ` Juri Linkov
2020-12-09  9:34               ` martin rudalics
2020-12-09 10:06                 ` Jean Louis
2020-12-09 15:16                   ` martin rudalics
2020-12-09 19:11                 ` Juri Linkov
2020-12-10  7:44                   ` martin rudalics
2020-12-10  8:30                     ` Jean Louis
2020-12-10  9:46                       ` martin rudalics
2020-12-10 10:16                         ` Jean Louis
2020-12-10 11:52                           ` martin rudalics
2020-12-10 12:07                             ` Jean Louis
2020-12-11  9:39                               ` Juri Linkov
2020-12-12  1:47                                 ` Jean Louis
2020-12-10  8:32                     ` Juri Linkov
2020-12-10  9:47                       ` martin rudalics
2020-12-10 10:21                         ` Jean Louis
2020-12-10 11:52                           ` martin rudalics
2020-12-10 12:21                             ` Jean Louis
2020-12-12 20:49                         ` Juri Linkov
2020-12-13  7:26                           ` martin rudalics
2020-12-14 20:28                             ` Juri Linkov
2020-12-15  7:59                               ` martin rudalics
2021-01-15  8:57                               ` Juri Linkov
2021-04-19 13:54                                 ` Stefan Monnier
2021-04-19 16:02                                   ` martin rudalics
2021-04-19 18:09                                     ` Juri Linkov
2021-04-19 13:52                               ` Stefan Monnier
2021-04-19 16:02                                 ` martin rudalics
2021-04-19 16:22                                   ` Stefan Monnier
2021-04-19 17:11                                     ` martin rudalics
2020-12-08  5:33       ` Richard Stallman
2020-12-08 15:13         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a7c3ef0-619d-cd76-a4e4-040009e33d75@gmx.at \
    --to=rudalics@gmx.at \
    --cc=45072@debbugs.gnu.org \
    --cc=bugs@gnu.support \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.