emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 f9ee83bfb9: do_switch_frame: before leaving mini-window, check


From: Alan Mackenzie
Subject: emacs-28 f9ee83bfb9: do_switch_frame: before leaving mini-window, check other (mru) window is live
Date: Sat, 28 May 2022 08:57:24 -0400 (EDT)

branch: emacs-28
commit f9ee83bfb9f09a32ca8c15385f0cd3ec12ebde8c
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    do_switch_frame: before leaving mini-window, check other (mru) window is 
live
    
    This fixes bug#55684.  There, with a minibuffer-only frame at start up,
    Emacs tried to switch to this frame, whose selected window was the
    mini-window.  There is no other active window in this frame, so the
    attempt to swith to another window failed.
    
    * src/frame.c (do_switch_frame): On switching to a frame whose selected
    window is as above, before selecting the most recently used window, check
    this ostensible window is an actual live window.  Otherwise leave the
    mini-window selected.
---
 src/frame.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/frame.c b/src/frame.c
index dc8045f41e..0c278259a7 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1568,8 +1568,14 @@ do_switch_frame (Lisp_Object frame, int track, int 
for_deletion, Lisp_Object nor
      to a different window, the most recently used one, unless there is a
      valid active minibuffer in the mini-window.  */
   if (EQ (f->selected_window, f->minibuffer_window)
+      /* The following test might fail if the mini-window contains a
+        non-active minibuffer.  */
       && NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt)))
-    Fset_frame_selected_window (frame, call1 (Qget_mru_window, frame), Qnil);
+    {
+      Lisp_Object w = call1 (Qget_mru_window, frame);
+      if (WINDOW_LIVE_P (w)) /* W can be nil in minibuffer-only frames.  */
+        Fset_frame_selected_window (frame, w, Qnil);
+    }
 
   Fselect_window (f->selected_window, norecord);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]