diff options
| author | Martin Rudalics | 2012-08-27 10:31:19 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2012-08-27 10:31:19 +0200 |
| commit | c4b6914d3621942393a3a69d5cee3e39e13c6227 (patch) | |
| tree | 9bd128ee1592b4b4b24dc7f20844de13cae05252 /src | |
| parent | 35aaa1ea263181d058228a6ea232197c7c88a7a1 (diff) | |
| download | emacs-c4b6914d3621942393a3a69d5cee3e39e13c6227.tar.gz emacs-c4b6914d3621942393a3a69d5cee3e39e13c6227.zip | |
Address two problems in Fset_window_configuration (Bug#8789) and (Bug#12208).
* window.c (Fset_window_configuration): Record any window's old
buffer if it's replaced (see Bug#8789). If the new current
buffer doesn't appear in the selected window, go to its old
point (Bug#12208).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/window.c | 31 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ec7267913d6..ee0aeed86f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-08-27 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.c (Fset_window_configuration): Record any window's old | ||
| 4 | buffer if it's replaced (see Bug#8789). If the new current | ||
| 5 | buffer doesn't appear in the selected window, go to its old | ||
| 6 | point (Bug#12208). | ||
| 7 | |||
| 1 | 2012-08-27 Dmitry Antipov <dmantipov@yandex.ru> | 8 | 2012-08-27 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 9 | ||
| 3 | Special MEM_TYPE_SPARE to denote reserved memory. | 10 | Special MEM_TYPE_SPARE to denote reserved memory. |
diff --git a/src/window.c b/src/window.c index 4792e3bbea8..b3c5d276f97 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1969,6 +1969,9 @@ unshow_buffer (register struct window *w) | |||
| 1969 | is actually stored in that buffer, and the window's pointm isn't used. | 1969 | is actually stored in that buffer, and the window's pointm isn't used. |
| 1970 | So don't clobber point in that buffer. */ | 1970 | So don't clobber point in that buffer. */ |
| 1971 | if (! EQ (buf, XWINDOW (selected_window)->buffer) | 1971 | if (! EQ (buf, XWINDOW (selected_window)->buffer) |
| 1972 | /* Don't clobber point in current buffer either (this could be | ||
| 1973 | useful in connection with bug#12208). | ||
| 1974 | && XBUFFER (buf) != current_buffer */ | ||
| 1972 | /* This line helps to fix Horsley's testbug.el bug. */ | 1975 | /* This line helps to fix Horsley's testbug.el bug. */ |
| 1973 | && !(WINDOWP (BVAR (b, last_selected_window)) | 1976 | && !(WINDOWP (BVAR (b, last_selected_window)) |
| 1974 | && w != XWINDOW (BVAR (b, last_selected_window)) | 1977 | && w != XWINDOW (BVAR (b, last_selected_window)) |
| @@ -3135,7 +3138,7 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 3135 | DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, | 3138 | DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, |
| 3136 | Srun_window_configuration_change_hook, 1, 1, 0, | 3139 | Srun_window_configuration_change_hook, 1, 1, 0, |
| 3137 | doc: /* Run `window-configuration-change-hook' for FRAME. */) | 3140 | doc: /* Run `window-configuration-change-hook' for FRAME. */) |
| 3138 | (Lisp_Object frame) | 3141 | (Lisp_Object frame) |
| 3139 | { | 3142 | { |
| 3140 | CHECK_LIVE_FRAME (frame); | 3143 | CHECK_LIVE_FRAME (frame); |
| 3141 | run_window_configuration_change_hook (XFRAME (frame)); | 3144 | run_window_configuration_change_hook (XFRAME (frame)); |
| @@ -5613,6 +5616,24 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5613 | int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); | 5616 | int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); |
| 5614 | int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); | 5617 | int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); |
| 5615 | 5618 | ||
| 5619 | /* Don't do this within the main loop below: This may call Lisp | ||
| 5620 | code and is thus potentially unsafe while input is blocked. */ | ||
| 5621 | for (k = 0; k < saved_windows->header.size; k++) | ||
| 5622 | { | ||
| 5623 | p = SAVED_WINDOW_N (saved_windows, k); | ||
| 5624 | window = p->window; | ||
| 5625 | w = XWINDOW (window); | ||
| 5626 | |||
| 5627 | if (!NILP (p->buffer) | ||
| 5628 | && ((!EQ (w->buffer, p->buffer) | ||
| 5629 | && !NILP (BVAR (XBUFFER (p->buffer), name))) | ||
| 5630 | || NILP (w->buffer) | ||
| 5631 | || NILP (BVAR (XBUFFER (w->buffer), name)))) | ||
| 5632 | /* Record old buffer of window when its buffer is going to | ||
| 5633 | change. */ | ||
| 5634 | call1 (Qrecord_window_buffer, window); | ||
| 5635 | } | ||
| 5636 | |||
| 5616 | /* The mouse highlighting code could get screwed up | 5637 | /* The mouse highlighting code could get screwed up |
| 5617 | if it runs during this. */ | 5638 | if it runs during this. */ |
| 5618 | BLOCK_INPUT; | 5639 | BLOCK_INPUT; |
| @@ -5900,7 +5921,13 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5900 | } | 5921 | } |
| 5901 | 5922 | ||
| 5902 | if (!NILP (new_current_buffer)) | 5923 | if (!NILP (new_current_buffer)) |
| 5903 | Fset_buffer (new_current_buffer); | 5924 | { |
| 5925 | Fset_buffer (new_current_buffer); | ||
| 5926 | /* If the new current buffer doesn't appear in the selected | ||
| 5927 | window, go to its old point (see bug#12208). */ | ||
| 5928 | if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | ||
| 5929 | Fgoto_char (make_number (old_point)); | ||
| 5930 | } | ||
| 5904 | 5931 | ||
| 5905 | Vminibuf_scroll_window = data->minibuf_scroll_window; | 5932 | Vminibuf_scroll_window = data->minibuf_scroll_window; |
| 5906 | minibuf_selected_window = data->minibuf_selected_window; | 5933 | minibuf_selected_window = data->minibuf_selected_window; |