From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#63967: 28.2; switch-to-buffer in normal window fails if minibuffer window is active Date: Sat, 17 Jun 2023 11:31:54 +0000 Message-ID: References: <83fs701uts.fsf@gnu.org> <83a5x81m33.fsf@gnu.org> <83a5x6zj38.fsf@gnu.org> <83zg56xfyr.fsf@gnu.org> <83v8frursu.fsf@gnu.org> <83jzw6utnx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1549"; mail-complaints-to="usenet@ciao.gmane.io" Cc: al@petrofsky.org, rudalics@gmx.at, acm@muc.de, monnier@iro.umontreal.ca, 63967@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 17 13:33:39 2023 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 1qAUBV-0000A5-RK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Jun 2023 13:33:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAUB0-0002jv-Ih; Sat, 17 Jun 2023 07:33:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAUAy-0002jA-5v for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 07:33:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAUAx-0007JF-8t for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 07:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAUAx-0008E4-5N for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 07:33:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Jun 2023 11:33:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63967 X-GNU-PR-Package: emacs Original-Received: via spool by 63967-submit@debbugs.gnu.org id=B63967.168700152631518 (code B ref 63967); Sat, 17 Jun 2023 11:33:03 +0000 Original-Received: (at 63967) by debbugs.gnu.org; 17 Jun 2023 11:32:06 +0000 Original-Received: from localhost ([127.0.0.1]:50960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAUA2-0008CI-9R for submit@debbugs.gnu.org; Sat, 17 Jun 2023 07:32:06 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:15420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAU9y-0008Bi-Bg for 63967@debbugs.gnu.org; Sat, 17 Jun 2023 07:32:05 -0400 Original-Received: (qmail 95934 invoked by uid 3782); 17 Jun 2023 13:31:55 +0200 Original-Received: from acm.muc.de (p4fe152e6.dip0.t-ipconnect.de [79.225.82.230]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 17 Jun 2023 13:31:55 +0200 Original-Received: (qmail 20481 invoked by uid 1000); 17 Jun 2023 11:31:54 -0000 Content-Disposition: inline In-Reply-To: <83jzw6utnx.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263526 Archived-At: Hello, Eli. On Wed, Jun 14, 2023 at 15:15:14 +0300, Eli Zaretskii wrote: > > Date: Tue, 13 Jun 2023 21:36:37 +0000 > > Cc: al@petrofsky.org, rudalics@gmx.at, monnier@iro.umontreal.ca, > > 63967@debbugs.gnu.org, acm@muc.de > > From: Alan Mackenzie > > > > So I see the fix somewhat along the lines of removing the offending > > Fset_frame_selected_window from minibuffer_unwind, and maybe rearranging > > the calls to record_unwind_protect* in read_minibuf to arrange for the > > window configuration call to do the job of restoring the "current" > > window. > > > > It seems to me you might want to put the fix into Emacs 29. Am I right? > Yes. I wouldn't be pinging you if it weren't so. > So I hope you will present a suggested patch soon, and that it will be > simple and safe enough to install on the release branch. TIA. After spending quite some time looking at why that call to Fset_frame_selected_window went in in the first place, and checking quite a few of the bug scenarios from 2021, I'm now convinced that the sole fix we need is to remove that call from minibuffer_unwind. It's certainly a simple patch, and I think it's safe enough for Emacs 29. Maybe other people (e.g. Martin) would be good enough to give it a quick going over before we commit it. diff --git a/src/minibuf.c b/src/minibuf.c index d5f95968ae1..bcb7eb9375d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1266,9 +1266,6 @@ minibuffer_unwind (void) set_window_buffer (window, Fcar (entry), 0, 0); Fset_window_start (window, Fcar (Fcdr (entry)), Qnil); Fset_window_point (window, Fcar (Fcdr (Fcdr (entry)))); - /* set-window-configuration may/will have unselected the - mini-window as the selected window. Restore it. */ - Fset_frame_selected_window (exp_MB_frame, window, Qnil); } else set_window_buffer (window, nth_minibuffer (0), 0, 0); -- Alan Mackenzie (Nuremberg, Germany).