diff options
author | Alan Mackenzie <acm@muc.de> | 2021-03-21 16:54:31 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2021-03-21 16:54:31 +0000 |
commit | 7c2ebf6e23663fdc7b1880a4d7caeadc8c47c00e (patch) | |
tree | 19216102a0b7fc0212b8cdfa6fc8d70ed6ad86b4 /src/window.c | |
parent | e276810dff9838e1bb8c2ec450f85835ed60bf14 (diff) | |
download | emacs-7c2ebf6e23663fdc7b1880a4d7caeadc8c47c00e.tar.gz emacs-7c2ebf6e23663fdc7b1880a4d7caeadc8c47c00e.tar.bz2 emacs-7c2ebf6e23663fdc7b1880a4d7caeadc8c47c00e.zip |
Prevent open minibuffers getting lost when their frame gets deleted
This happened with minibuffer-follows-selected-frame set to t.
* doc/emacs/mini.texi (Basic Minibuffer): State where a command's action takes
place when a minibuffer's frame has been deleted.
* lisp/window.el (window--before-delete-windows, record-window-buffer): Take
into account that minibuffers are now recorded on w->prev_buffers field.
* src/fns.c (merge_c): New version of `merge' taking a C function, rather than
a Lisp function as the comparison function.
* src/frame.c (do_switch_frame): Pass arguments sf and for_deletion to
move_minibuffers_onnto_frame.
* src/lisp.h (top level): Declare merge_c and
move_minibuffers_onto_selected_frame.
* src/minibuf.c (MB_frame): New Lisp_Object recording the minibuffer's frame.
(choose_minibuf_frame): Remove all code except that which sets minibuf_window
to the current frame's minibuffer.
(minibuffer_ent_greater): New comparison function, passed to merge_c.
(zip_minibuffer_stacks): New function.
(move_minibuffers_onto_frame): Renamed from `move_minibuffer_onto_frame' given
two arguments, the old frame and for_deletion, and simplified. Minibuffers
are now stacked in the mini-window's ->prev_buffers field.
(read_minibuf): Several detailed amendments.
(exp_MB_frame): New Lisp_Object, the expired minibuffer's frame.
(read_minibuf_unwind): Search for the expired minibuffer's frame, rather than
taking it from (unreliable) variables. Switch temporarily to this frame for
tidying up operations.
(minibuffer_unwind): New function which pops a stacked minibuffer.
(syms_of_minibuf): Call staticpro for the two new Lisp variables.
* src/window.c (Fset_window_configuration): Don't record minibuffers with
record-window-buffer.
* src/xdisp.c (gui_consider_frame_title): Remove redundant Fselect_window,
which caused an unwanted frame switch. Amend the arguments to
format_mode_line_unwind_data to match.
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c index eb16e2a4338..4d5c7e763ec 100644 --- a/src/window.c +++ b/src/window.c @@ -6958,7 +6958,8 @@ the return value is nil. Otherwise the value is t. */) if (BUFFERP (w->contents) && !EQ (w->contents, p->buffer) - && BUFFER_LIVE_P (XBUFFER (p->buffer))) + && BUFFER_LIVE_P (XBUFFER (p->buffer)) + && (NILP (Fminibufferp (p->buffer, Qnil)))) /* If a window we restore gets another buffer, record the window's old buffer. */ call1 (Qrecord_window_buffer, window); |