From: Eli Zaretskii <eliz@gnu.org>
To: Al Petrofsky <al@petrofsky.org>,
martin rudalics <rudalics@gmx.at>,
Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 63967@debbugs.gnu.org
Subject: bug#63967: 28.2; switch-to-buffer in normal window fails if minibuffer window is active
Date: Fri, 09 Jun 2023 14:16:17 +0300 [thread overview]
Message-ID: <83o7lo28e6.fsf@gnu.org> (raw)
In-Reply-To: <CAPMQwz4j1gmoz5vWxNDk4vo9UR3XiaC2U2ud9vngC0HsxZkAWA@mail.gmail.com> (message from Al Petrofsky on Thu, 8 Jun 2023 17:32:56 -0400)
> From: Al Petrofsky <al@petrofsky.org>
> Date: Thu, 8 Jun 2023 17:32:56 -0400
>
> While the minibuffer window is active, attempt to switch buffers in
> an ordinary window like so:
>
> emacs -Q
> M-: (setq enable-recursive-minibuffers t) RET
> M-x C-x o C-x b foo RET
>
> In emacs 27 and earlier, that will switch the buffer in the main
> window to the new buffer named "foo", but in emacs 28.2, it generates
> a bogus "user-error: Cannot switch buffers in minibuffer window".
Seems like read-buffer-to-switch (called by "C-x b") changes the
selected-window: when it returns, the rest of the function runs with
the minibuffer window being the selected-window, which is wrong in
this case.
I couldn't find the offending change, but I doubt that bisection would
help us in this case, given how many water went under the bridge of
using the minibuffer and saving/restoring the window configuration.
The ugly kludge below seems to fix the problem.
Stefan and Martin, any better ideas or hints?
diff --git a/lisp/window.el b/lisp/window.el
index a11b1a5..6777944 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8941,7 +8941,9 @@ switch-to-buffer
"Cannot switch buffers in a dedicated window")))
('pop nil)
(_ (set-window-dedicated-p nil nil) 'force-same-window)))))))
- (list (read-buffer-to-switch "Switch to buffer: ") nil force-same-window)))
+ (save-selected-window
+ (list
+ (read-buffer-to-switch "Switch to buffer: ") nil force-same-window))))
(let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))
(set-window-start-and-point (not switch-to-buffer-obey-display-actions)))
(cond
next prev parent reply other threads:[~2023-06-09 11:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 21:32 bug#63967: 28.2; switch-to-buffer in normal window fails if minibuffer window is active Al Petrofsky
2023-06-09 11:16 ` Eli Zaretskii [this message]
2023-06-09 15:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-09 16:09 ` Eli Zaretskii
2023-06-09 19:18 ` Eli Zaretskii
2023-06-10 15:49 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-10 19:42 ` Alan Mackenzie
2023-06-11 5:03 ` Eli Zaretskii
2023-06-11 13:40 ` Alan Mackenzie
2023-06-11 13:53 ` Eli Zaretskii
2023-06-13 18:43 ` Eli Zaretskii
2023-06-13 21:36 ` Alan Mackenzie
2023-06-14 12:15 ` Eli Zaretskii
2023-06-15 10:25 ` Alan Mackenzie
2023-06-17 11:31 ` Alan Mackenzie
2023-06-17 13:08 ` Eli Zaretskii
2023-06-17 13:52 ` martin rudalics
2023-06-17 16:23 ` Alan Mackenzie
2023-06-17 18:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-11 14:35 ` Drew Adams
2023-06-11 16:01 ` Alan Mackenzie
2023-06-12 7:17 ` martin rudalics
2023-06-12 12:04 ` Eli Zaretskii
2023-06-11 16:12 ` Eli Zaretskii
2023-06-09 16:52 ` Gregory Heytings
2023-06-09 17:21 ` Eli Zaretskii
2023-06-09 20:04 ` Gregory Heytings
2023-06-10 5:59 ` Eli Zaretskii
2023-06-10 6:39 ` Gregory Heytings
2023-06-10 6:45 ` Eli Zaretskii
2023-06-10 8:45 ` Gregory Heytings
2023-06-10 6:52 ` martin rudalics
2023-06-10 8:28 ` Eli Zaretskii
2023-06-10 14:51 ` martin rudalics
2023-06-10 17:09 ` Eli Zaretskii
2023-06-11 8:10 ` martin rudalics
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=83o7lo28e6.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=63967@debbugs.gnu.org \
--cc=al@petrofsky.org \
--cc=monnier@iro.umontreal.ca \
--cc=rudalics@gmx.at \
/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.