From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63967: 28.2; switch-to-buffer in normal window fails if minibuffer window is active Date: Fri, 09 Jun 2023 22:18:08 +0300 Message-ID: <83a5x81m33.fsf@gnu.org> References: <83o7lo28e6.fsf@gnu.org> <83fs701uts.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29332"; mail-complaints-to="usenet@ciao.gmane.io" Cc: al@petrofsky.org, rudalics@gmx.at, 63967@debbugs.gnu.org To: Stefan Monnier , Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 09 21:19:34 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 1q7he2-0007N2-64 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 09 Jun 2023 21:19:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7hda-0005W3-B3; Fri, 09 Jun 2023 15:19: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 1q7hdW-0005Vc-Hq for bug-gnu-emacs@gnu.org; Fri, 09 Jun 2023 15:19: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 1q7hdW-0001iF-9I for bug-gnu-emacs@gnu.org; Fri, 09 Jun 2023 15:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q7hdW-0005bI-3v for bug-gnu-emacs@gnu.org; Fri, 09 Jun 2023 15:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Jun 2023 19:19:02 +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.168633831121491 (code B ref 63967); Fri, 09 Jun 2023 19:19:02 +0000 Original-Received: (at 63967) by debbugs.gnu.org; 9 Jun 2023 19:18:31 +0000 Original-Received: from localhost ([127.0.0.1]:60359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7hd1-0005aZ-0Z for submit@debbugs.gnu.org; Fri, 09 Jun 2023 15:18:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q7hcy-0005aJ-57 for 63967@debbugs.gnu.org; Fri, 09 Jun 2023 15:18:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7hcr-0001US-2I; Fri, 09 Jun 2023 15:18:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W/ycByNmkZjva10/+wR4nrifJsZn2M4BI1AudA9wQYg=; b=dTvj3L22ewJ6 T46rLlg2nryR7YSIy4hQC9XH4mqhn/GQhVookg1nBKCs7jwkx7F4n/A5ROFxKP3kCKACzxuzOPUfY lmZ8HWMk+H7i0kQYTmvCt+8oFKbokdCFOCYbSVNvEsIpZAAtwoLL0nBqyEn4fMfqSZ1yc7Yev4saO 0YCypCx1IVQdgCGQyzwuanDwTP7RlSRDX8k+kUTfEqaWcxHC476/ARBfCOSYxc6jggnaiUaPsSFTu t1Qwc3BV9JuJd4tWAG5mX1CcfG12rTcuM6tJLztV5VnOkW9z6y+hi3WoeCA8wHkWg0JnK/u7JBvaw sCPGUrCa85uMfj34cHHSWw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7hcd-0006kW-7b; Fri, 09 Jun 2023 15:18:20 -0400 In-Reply-To: <83fs701uts.fsf@gnu.org> (message from Eli Zaretskii on Fri, 09 Jun 2023 19:09:19 +0300) 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:263183 Archived-At: > Cc: al@petrofsky.org, rudalics@gmx.at, 63967@debbugs.gnu.org > Date: Fri, 09 Jun 2023 19:09:19 +0300 > From: Eli Zaretskii > > > And if it happens with `read-buffer-to-switch` I can't see any reason > > why it wouldn't happen for most/all other uses of the minibuffer. > > It probably does, yes. AFAICT, the clobbering of the selected window happens in minibuffer_unwind: static void minibuffer_unwind (void) { struct frame *f; struct window *w; Lisp_Object window; Lisp_Object entry; if (NILP (exp_MB_frame)) return; /* "Can't happen." */ f = XFRAME (exp_MB_frame); window = f->minibuffer_window; w = XWINDOW (window); if (FRAME_LIVE_P (f)) { /* minibuf_window = sf->minibuffer_window; */ if (!NILP (w->prev_buffers)) { entry = Fcar (w->prev_buffers); w->prev_buffers = Fcdr (w->prev_buffers); 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); } } And since minibuffer_unwind is called _after_ restore_window_configuration, it overwrites what the latter does. Why minibuffer_unwind doesn't test some condition which would tell it at all has to do something, I don't know. It seems to think that the frame exp_MB_frame is still live and that its "expired" minibuffer needs to be replaced? why? Is the logic inside read_minibuf_unwind flawed in the case that enable_recursive_minibuffers is non-zero?