From 218e997a10bc1bc2eebde639f9b0aaddc525159d Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Wed, 31 Oct 2012 11:02:51 +0100 Subject: [PATCH] Install fixes for Bug#12764 and Bug#12766. * window.el (quit-restore-window): If the window has been created on an existing frame and ended up as the sole window on that frame, do not delete it (Bug#12764). * minibuf.c (read_minibuf): Restore current buffer since choose_minibuf_frame calling Fset_frame_selected_window may change it (Bug#12766). --- lisp/ChangeLog | 6 ++++++ lisp/window.el | 7 ++++++- src/ChangeLog | 6 ++++++ src/minibuf.c | 4 ++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 88ea199cd20..dc928c35672 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-10-31 Martin Rudalics + + * window.el (quit-restore-window): If the window has been + created on an existing frame and ended up as the sole window on + that frame, do not delete it (Bug#12764). + 2012-10-31 Stefan Monnier * progmodes/sh-script.el (sh--inside-noncommand-expression): diff --git a/lisp/window.el b/lisp/window.el index bd043390d90..10f75d44d69 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -3556,7 +3556,12 @@ the buffer of WINDOW. The following values are handled: quad entry) (cond ((and (not prev-buffer) - (memq (nth 1 quit-restore) '(window frame)) + (or (eq (nth 1 quit-restore) 'frame) + (and (eq (nth 1 quit-restore) 'window) + ;; If the window has been created on an existing + ;; frame and ended up as the sole window on that + ;; frame, do not delete it (Bug#12764). + (not (eq window (frame-root-window window))))) (eq (nth 3 quit-restore) buffer) ;; Delete WINDOW if possible. (window--delete window nil (eq bury-or-kill 'kill))) diff --git a/src/ChangeLog b/src/ChangeLog index 1ae99a22cf9..3ad653efd0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-10-31 Martin Rudalics + + * minibuf.c (read_minibuf): Restore current buffer since + choose_minibuf_frame calling Fset_frame_selected_window may + change it (Bug#12766). + 2012-10-30 Jan Djärv * frame.c (Fframe_pixel_height): Fix documentation (Bug#12733). diff --git a/src/minibuf.c b/src/minibuf.c index 2cc89e75680..dcc4af37c13 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -472,6 +472,10 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, /* Choose the minibuffer window and frame, and take action on them. */ + /* Prepare for restoring the current buffer since choose_minibuf_frame + calling Fset_frame_selected_window may change it (Bug#12766). */ + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); + choose_minibuf_frame (); record_unwind_protect (choose_minibuf_frame_1, Qnil); -- 2.39.2