diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c index e6d0280d9b0..409b01f302e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6610,10 +6610,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6610 | make_number (old_point), | 6610 | make_number (old_point), |
| 6611 | XWINDOW (data->current_window)->contents); | 6611 | XWINDOW (data->current_window)->contents); |
| 6612 | 6612 | ||
| 6613 | /* In the following call to `select-window', prevent "swapping out | 6613 | /* In the following call to select_window, prevent "swapping out |
| 6614 | point" in the old selected window using the buffer that has | 6614 | point" in the old selected window using the buffer that has |
| 6615 | been restored into it. We already swapped out that point from | 6615 | been restored into it. We already swapped out that point |
| 6616 | that window's old buffer. | 6616 | from that window's old buffer. |
| 6617 | 6617 | ||
| 6618 | Do not record the buffer here. We do that in a separate call | 6618 | Do not record the buffer here. We do that in a separate call |
| 6619 | to select_window below. See also Bug#16207. */ | 6619 | to select_window below. See also Bug#16207. */ |
| @@ -6656,10 +6656,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6656 | if (WINDOW_LIVE_P (data->current_window)) | 6656 | if (WINDOW_LIVE_P (data->current_window)) |
| 6657 | select_window (data->current_window, Qnil, false); | 6657 | select_window (data->current_window, Qnil, false); |
| 6658 | 6658 | ||
| 6659 | /* Fselect_window will have made f the selected frame, so we | 6659 | /* select_window will have made f the selected frame, so we |
| 6660 | reselect the proper frame here. Fhandle_switch_frame will change the | 6660 | reselect the proper frame here. do_switch_frame will change |
| 6661 | selected window too, but that doesn't make the call to | 6661 | the selected window too, but that doesn't make the call to |
| 6662 | Fselect_window above totally superfluous; it still sets f's | 6662 | select_window above totally superfluous; it still sets f's |
| 6663 | selected window. */ | 6663 | selected window. */ |
| 6664 | if (FRAME_LIVE_P (XFRAME (data->selected_frame))) | 6664 | if (FRAME_LIVE_P (XFRAME (data->selected_frame))) |
| 6665 | do_switch_frame (data->selected_frame, 0, 0, Qnil); | 6665 | do_switch_frame (data->selected_frame, 0, 0, Qnil); |
| @@ -6696,8 +6696,21 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6696 | { | 6696 | { |
| 6697 | Fset_buffer (new_current_buffer); | 6697 | Fset_buffer (new_current_buffer); |
| 6698 | /* If the new current buffer doesn't appear in the selected | 6698 | /* If the new current buffer doesn't appear in the selected |
| 6699 | window, go to its old point (see bug#12208). */ | 6699 | window, go to its old point (Bug#12208). |
| 6700 | if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) | 6700 | |
| 6701 | The original fix used data->current_window below which caused | ||
| 6702 | false positives (compare Bug#31695) when data->current_window | ||
| 6703 | is not on data->selected_frame. This happens, for example, | ||
| 6704 | when read_minibuf restores the configuration of a stand-alone | ||
| 6705 | minibuffer frame: After switching to the previously selected | ||
| 6706 | "normal" frame, point of that frame's selected window jumped | ||
| 6707 | unexpectedly because new_current_buffer is usually *not* | ||
| 6708 | shown in data->current_window - the minibuffer frame's | ||
| 6709 | selected window. Using selected_window instead fixes this | ||
| 6710 | because do_switch_frame has set up selected_window already to | ||
| 6711 | the "normal" frame's selected window and that window *does* | ||
| 6712 | show new_current_buffer. */ | ||
| 6713 | if (!EQ (XWINDOW (selected_window)->contents, new_current_buffer)) | ||
| 6701 | Fgoto_char (make_number (old_point)); | 6714 | Fgoto_char (make_number (old_point)); |
| 6702 | } | 6715 | } |
| 6703 | 6716 | ||