diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/window.c b/src/window.c index 4d92566b243..ba1ec2544f8 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -54,7 +54,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 54 | #include "nsterm.h" | 54 | #include "nsterm.h" |
| 55 | #endif | 55 | #endif |
| 56 | 56 | ||
| 57 | Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p; | 57 | Lisp_Object Qwindowp, Qwindow_live_p; |
| 58 | static Lisp_Object Qwindow_valid_p; | ||
| 58 | static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; | 59 | static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; |
| 59 | static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; | 60 | static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; |
| 60 | static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; | 61 | static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; |
| @@ -268,7 +269,7 @@ decode_any_window (register Lisp_Object window) | |||
| 268 | return w; | 269 | return w; |
| 269 | } | 270 | } |
| 270 | 271 | ||
| 271 | struct window * | 272 | static struct window * |
| 272 | decode_valid_window (register Lisp_Object window) | 273 | decode_valid_window (register Lisp_Object window) |
| 273 | { | 274 | { |
| 274 | struct window *w; | 275 | struct window *w; |
| @@ -1968,6 +1969,9 @@ unshow_buffer (register struct window *w) | |||
| 1968 | 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. |
| 1969 | So don't clobber point in that buffer. */ | 1970 | So don't clobber point in that buffer. */ |
| 1970 | 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 */ | ||
| 1971 | /* This line helps to fix Horsley's testbug.el bug. */ | 1975 | /* This line helps to fix Horsley's testbug.el bug. */ |
| 1972 | && !(WINDOWP (BVAR (b, last_selected_window)) | 1976 | && !(WINDOWP (BVAR (b, last_selected_window)) |
| 1973 | && w != XWINDOW (BVAR (b, last_selected_window)) | 1977 | && w != XWINDOW (BVAR (b, last_selected_window)) |
| @@ -3097,7 +3101,7 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 3097 | /* Use the right buffer. Matters when running the local hooks. */ | 3101 | /* Use the right buffer. Matters when running the local hooks. */ |
| 3098 | if (current_buffer != XBUFFER (Fwindow_buffer (Qnil))) | 3102 | if (current_buffer != XBUFFER (Fwindow_buffer (Qnil))) |
| 3099 | { | 3103 | { |
| 3100 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 3104 | record_unwind_current_buffer (); |
| 3101 | Fset_buffer (Fwindow_buffer (Qnil)); | 3105 | Fset_buffer (Fwindow_buffer (Qnil)); |
| 3102 | } | 3106 | } |
| 3103 | 3107 | ||
| @@ -3134,7 +3138,7 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 3134 | DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, | 3138 | DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, |
| 3135 | Srun_window_configuration_change_hook, 1, 1, 0, | 3139 | Srun_window_configuration_change_hook, 1, 1, 0, |
| 3136 | doc: /* Run `window-configuration-change-hook' for FRAME. */) | 3140 | doc: /* Run `window-configuration-change-hook' for FRAME. */) |
| 3137 | (Lisp_Object frame) | 3141 | (Lisp_Object frame) |
| 3138 | { | 3142 | { |
| 3139 | CHECK_LIVE_FRAME (frame); | 3143 | CHECK_LIVE_FRAME (frame); |
| 3140 | run_window_configuration_change_hook (XFRAME (frame)); | 3144 | run_window_configuration_change_hook (XFRAME (frame)); |
| @@ -3201,7 +3205,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3201 | because that might itself be a local variable. */ | 3205 | because that might itself be a local variable. */ |
| 3202 | if (window_initialized) | 3206 | if (window_initialized) |
| 3203 | { | 3207 | { |
| 3204 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 3208 | record_unwind_current_buffer (); |
| 3205 | Fset_buffer (buffer); | 3209 | Fset_buffer (buffer); |
| 3206 | } | 3210 | } |
| 3207 | 3211 | ||
| @@ -5899,7 +5903,13 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5899 | } | 5903 | } |
| 5900 | 5904 | ||
| 5901 | if (!NILP (new_current_buffer)) | 5905 | if (!NILP (new_current_buffer)) |
| 5902 | Fset_buffer (new_current_buffer); | 5906 | { |
| 5907 | Fset_buffer (new_current_buffer); | ||
| 5908 | /* If the new current buffer doesn't appear in the selected | ||
| 5909 | window, go to its old point (see bug#12208). */ | ||
| 5910 | if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | ||
| 5911 | Fgoto_char (make_number (old_point)); | ||
| 5912 | } | ||
| 5903 | 5913 | ||
| 5904 | Vminibuf_scroll_window = data->minibuf_scroll_window; | 5914 | Vminibuf_scroll_window = data->minibuf_scroll_window; |
| 5905 | minibuf_selected_window = data->minibuf_selected_window; | 5915 | minibuf_selected_window = data->minibuf_selected_window; |