GNU bug report logs - #63967
28.2; switch-to-buffer in normal window fails if minibuffer window is active

Previous Next

Package: emacs;

Reported by: Al Petrofsky <al <at> petrofsky.org>

Date: Fri, 9 Jun 2023 04:10:02 UTC

Severity: normal

Found in version 28.2

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 63967 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Eli Zaretskii <eliz <at> gnu.org>, Al Petrofsky <al <at> petrofsky.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 63967 <at> debbugs.gnu.org
Subject: Re: bug#63967: 28.2; switch-to-buffer in normal window fails if
 minibuffer window is active
Date: Sat, 10 Jun 2023 08:52:57 +0200
> 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

That wouldn't help in all other use cases of read_minibuf where the user
will be thrown back to the minibuffer window as well.  I'd rather try (the
still timid)

-static void minibuffer_unwind (void);
+static void minibuffer_unwind (Lisp_Object);
...
-  record_unwind_protect_void (minibuffer_unwind);
+  record_unwind_protect (minibuffer_unwind, selected_window);
...
-minibuffer_unwind (void)
+minibuffer_unwind (Lisp_Object old_selected_window)
...
+	  if (!EQ (old_selected_window, FRAME_SELECTED_WINDOW (f)))
+	    Fset_frame_selected_window (exp_MB_frame, window, Qnil);

since the last line seems to suggest that exp_MB_frame should not be the
selected frame.

martin




This bug report was last modified 1 year and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.