diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/window.c b/src/window.c index 9961c54161d..db324effcce 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 | } |
| @@ -5141,37 +5148,23 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 5141 | adjust_frame_glyphs (f); | 5148 | adjust_frame_glyphs (f); |
| 5142 | 5149 | ||
| 5143 | if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f))) | 5150 | if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f))) |
| 5144 | /* We deleted the frame's selected window. */ | 5151 | /* We apparently deleted the frame's selected window; use the |
| 5152 | frame's first window as substitute but don't record it yet. | ||
| 5153 | `delete-window' may have something better up its sleeves. */ | ||
| 5145 | { | 5154 | { |
| 5146 | /* Use the frame's first window as fallback ... */ | 5155 | /* Use the frame's first window as fallback ... */ |
| 5147 | Lisp_Object new_selected_window = Fframe_first_window (frame); | 5156 | Lisp_Object new_selected_window = Fframe_first_window (frame); |
| 5148 | /* ... but preferably use its most recently used window. */ | ||
| 5149 | Lisp_Object mru_window; | ||
| 5150 | 5157 | ||
| 5151 | /* `get-mru-window' might fail for some reason so play it safe | ||
| 5152 | - promote the first window _without recording it_ first. */ | ||
| 5153 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) | 5158 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) |
| 5154 | Fselect_window (new_selected_window, Qt); | 5159 | Fselect_window (new_selected_window, Qt); |
| 5155 | else | 5160 | else |
| 5156 | fset_selected_window (f, new_selected_window); | 5161 | /* Do not clear f->select_mini_window_flag here. If the |
| 5157 | 5162 | last selected window on F was an active minibuffer, we | |
| 5158 | unblock_input (); | 5163 | want to return to it on a later Fselect_frame. */ |
| 5159 | |||
| 5160 | /* Now look whether `get-mru-window' gets us something. */ | ||
| 5161 | mru_window = call1 (Qget_mru_window, frame); | ||
| 5162 | if (WINDOW_LIVE_P (mru_window) | ||
| 5163 | && EQ (XWINDOW (mru_window)->frame, frame)) | ||
| 5164 | new_selected_window = mru_window; | ||
| 5165 | |||
| 5166 | /* If all ended up well, we now promote the mru window. */ | ||
| 5167 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) | ||
| 5168 | Fselect_window (new_selected_window, Qnil); | ||
| 5169 | else | ||
| 5170 | fset_selected_window (f, new_selected_window); | 5164 | fset_selected_window (f, new_selected_window); |
| 5171 | } | 5165 | } |
| 5172 | else | ||
| 5173 | unblock_input (); | ||
| 5174 | 5166 | ||
| 5167 | unblock_input (); | ||
| 5175 | FRAME_WINDOW_CHANGE (f) = true; | 5168 | FRAME_WINDOW_CHANGE (f) = true; |
| 5176 | } | 5169 | } |
| 5177 | else | 5170 | else |