From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs 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: Tue, 8 Dec 2020 09:09:28 +0100 Message-ID: References: <86eek3hvu5.fsf@protected.rcdrun.com> <87eek1fvgf.fsf@gnus.org> <83eek18ref.fsf@gnu.org> <835z5d8lhc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------6BC1C4F906D49E33E409D905" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2705"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 45072@debbugs.gnu.org To: Eli Zaretskii , Jean Louis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 08 09:12:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmY6V-0000bQ-Ji for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 09:12:11 +0100 Original-Received: from localhost ([::1]:51224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmY6S-00076Z-Rf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 03:12:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmY5P-000768-S4 for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 03:11:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmY5P-0006xi-L5 for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 03:11:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kmY5O-0003sP-GQ for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 03:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2020 08:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45072 X-GNU-PR-Package: emacs Original-Received: via spool by 45072-submit@debbugs.gnu.org id=B45072.160741500914835 (code B ref 45072); Tue, 08 Dec 2020 08:11:02 +0000 Original-Received: (at 45072) by debbugs.gnu.org; 8 Dec 2020 08:10:09 +0000 Original-Received: from localhost ([127.0.0.1]:56463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmY4W-0003rB-Gg for submit@debbugs.gnu.org; Tue, 08 Dec 2020 03:10:08 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:54811) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmY4T-0003qQ-Vo for 45072@debbugs.gnu.org; Tue, 08 Dec 2020 03:10:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1607414968; bh=4YQ74zYFmSCce/nsWcovrDfo1MgZrIef7TeCqfbPtZE=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=OADN8fLYpCzsUIcmHkG2PeaL+frthV9QaIf0kL9hKBIuIib/gQwgoheRXkNKLLRiC q41bJreXAuHnXJd5coH5jtdjnLBMedGzNb4vHQDvPKOpy/qmDMcHevEQYDcuog/xNM 391WPWAWfLvkTiLQNj6l461VQhKvRGPtxHrGBHcM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.100] ([46.125.249.58]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N3bSj-1k3tv93ImJ-010h6p; Tue, 08 Dec 2020 09:09:28 +0100 In-Reply-To: <835z5d8lhc.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03:K1:Iv5m4e/Nch95P5egOkKaCmQe8t3VhWhXv+ccEuovj6J7qTLdUgD 56o43OyxdumpvKbP9nmUn2doEx/Y/wr7D6TLbSV5RZsJN5Yq2vsSxKWQ+bHc63UYNbQBm5v /6nNfGtpwxBQzEFHr3WtoAZ2qFW6rYanwOU0ZOS76UvHpasbFsdGjjobKDPWjFcFtg/dlnE ahQDMg3Q14QLuUDgJbCmQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZIY420JEFrY=:U5shya8KcPbqgNzwIXLqJI ADHc7qbJeF+DtrvmWZgL6skcfZjgLyx5WXnXPg/UuXLKKJN4wE25wDEl2cifjqb+y74qYj1uG t5TKypqBMajzEFHLEVwcL2kKu3gJCiHIx7ekWPBzt6GzMm3FAW6+TMx54lXrUP4+7Xi2at0Nz zxKzA9U0VSBSvSh91+maE6rDQAF5kcItq2qCBh+/7IBQZVKyW/YPJ/Z+tA80hd7tSx6SNTZMZ 7OWTm+4fweo2gJCXSXdLoNiUhGR0aV41F/xSU10EFZJrRdmu57jXaj+3psIt0aHCEYI7T9ha/ ZnmfeVT4D0IJmds86IFzIRZniw9t0p4OaUuWRI21ugIyX+FcqSJXlYLiuaW3KW6Eg2k1/bnVL 2YYjn9NGPHZczDDArozj2JPw8l0uuIlQwrgEKRT4GfAcWzb5A/MCDIqXXqanw+GcNbZ0nf247 IkNhXV5kaORfLOS9ntPXAnonQRo1XfdmRI+xMAHTP6eImH3E4+QSi5sG3OYCRQB7nQGLtXOps 4IcU+ZYD1PRPhEYBKUCW5mgNcxi0+DYwJpErNCqdjjFUHpuqWqpby2h8xV0G69nKBJtELfovC jdrOlfnQMvVE+X0BIoj5NIOYORzOAgBjQbVl8i/a9mrdeGvVec+b2Cq4A33l11hkeN92ZuKBQ J7jEu67yYXJgtDe9zo7MgZvbBJ8k7f4vX1zcnEp9DitDVdtgsP3Ko+ezZzV1yOqX0bX/O4frF KMo7agdKluynWQu9wejH54h9ZVQjqIVLMYLVgg4ztitZ2GtVE8xnxOZbgsespfTMSNxmdVFy X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195314 Archived-At: This is a multi-part message in MIME format. --------------6BC1C4F906D49E33E409D905 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > The defaults are definitely fine, IMO. But if you want very much to > have an opt-in behavior to disable restoring of the window > configuration of the frame, I won't object to such an option. Patch attached, just in case. 99% untested. martin --------------6BC1C4F906D49E33E409D905 Content-Type: text/x-patch; name="minibuf.c.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="minibuf.c.diff" diff --git a/src/minibuf.c b/src/minibuf.c index fc3fd92a88..9874e71a2f 100644 =2D-- 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_from_minibuffer_no_restore) + 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 =3D WINDOW_FRAME (XWINDOW (minibuf_window)); - if (!EQ (mini_frame, selected_frame)) + + if (!read_from_minibuffer_no_restore && !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_fra= me))); + 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,14 @@ syms_of_minibuf (void) uses to hide passwords. */); Vread_hide_char =3D Qnil; + DEFVAR_BOOL ("read-from-minibuffer-no-restore", read_from_minibuffer_no= _restore, + doc: /* Non-nil means `read-from-minibuffer' does not restore win= dow configurations. +If this is nil, `read-from-minibuffer' will restore, on exit, the window +configurations of the frame where it was called from and, if it is +different, the frame that owns the minibuffer window. If this is +non-nil, no such restorations are done. */); + read_from_minibuffer_no_restore =3D false; + defsubr (&Sactive_minibuffer_window); defsubr (&Sset_minibuffer_window); defsubr (&Sread_from_minibuffer); --------------6BC1C4F906D49E33E409D905--