diff options
| author | Alan Mackenzie | 2021-05-31 16:24:11 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2021-05-31 16:24:11 +0000 |
| commit | 2ee5ce208f212ed658cf2125ef6bc24a435dda50 (patch) | |
| tree | 964ca4a5906240e7c731595f7fdf90a7cfcb5307 /src/window.c | |
| parent | 63e9a4b1e1fe99462ec97b2145b91898fa5b4085 (diff) | |
| download | emacs-2ee5ce208f212ed658cf2125ef6bc24a435dda50.tar.gz emacs-2ee5ce208f212ed658cf2125ef6bc24a435dda50.zip | |
Make frames record when their selected window was the mini-window
When a frame in this state is selected again by Fselect_frame (but not by
Fselect_window), the mini-window rather than the frame's currently selected
window, is chosen for selection, should there still be an active minibuffer in
it.
This fixes bug #48674.
* src/frame.h (struct frame): Add new boolean field select_mini_window_flag.
* src/frame.c (make_frame): Initialize select_mini_window_flag to false.
(do_switch_frame): Set the new flag appropriately for the old frame, and
process the new frame's setting of this flag, before setting it to false.
* src/window.c (select_window): Set f->select_mini_window_flag to false.
(Fset_frame_selected_window, Fdelete_other_windows_internal)
(Fdelete_window_internal): Add comments clarifying that there is no clearing
of f->select_mini_window_flag in these functions.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index 9961c54161d..2d98ae5f156 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -468,6 +468,7 @@ Return WINDOW. */) | |||
| 468 | else | 468 | else |
| 469 | { | 469 | { |
| 470 | fset_selected_window (XFRAME (frame), window); | 470 | fset_selected_window (XFRAME (frame), window); |
| 471 | /* Don't clear FRAME's select_mini_window_flag here. */ | ||
| 471 | return window; | 472 | return window; |
| 472 | } | 473 | } |
| 473 | } | 474 | } |
| @@ -517,6 +518,9 @@ select_window (Lisp_Object window, Lisp_Object norecord, | |||
| 517 | /* Do not select a tooltip window (Bug#47207). */ | 518 | /* Do not select a tooltip window (Bug#47207). */ |
| 518 | error ("Cannot select a tooltip window"); | 519 | error ("Cannot select a tooltip window"); |
| 519 | 520 | ||
| 521 | /* We deinitely want to select WINDOW, not the mini-window. */ | ||
| 522 | f->select_mini_window_flag = false; | ||
| 523 | |||
| 520 | /* Make the selected window's buffer current. */ | 524 | /* Make the selected window's buffer current. */ |
| 521 | Fset_buffer (w->contents); | 525 | Fset_buffer (w->contents); |
| 522 | 526 | ||
| @@ -3242,6 +3246,9 @@ window-start value is reasonable when this function is called. */) | |||
| 3242 | if (EQ (selected_frame, w->frame)) | 3246 | if (EQ (selected_frame, w->frame)) |
| 3243 | Fselect_window (window, Qnil); | 3247 | Fselect_window (window, Qnil); |
| 3244 | else | 3248 | else |
| 3249 | /* Do not clear f->select_mini_window_flag here. If the | ||
| 3250 | last selected window on F was an active minibuffer, we | ||
| 3251 | want to return to it on a later Fselect_frame. */ | ||
| 3245 | fset_selected_window (f, window); | 3252 | fset_selected_window (f, window); |
| 3246 | } | 3253 | } |
| 3247 | } | 3254 | } |
| @@ -5153,6 +5160,9 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 5153 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) | 5160 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) |
| 5154 | Fselect_window (new_selected_window, Qt); | 5161 | Fselect_window (new_selected_window, Qt); |
| 5155 | else | 5162 | else |
| 5163 | /* Do not clear f->select_mini_window_flag here. If the | ||
| 5164 | last selected window on F was an active minibuffer, we | ||
| 5165 | want to return to it on a later Fselect_frame. */ | ||
| 5156 | fset_selected_window (f, new_selected_window); | 5166 | fset_selected_window (f, new_selected_window); |
| 5157 | 5167 | ||
| 5158 | unblock_input (); | 5168 | unblock_input (); |