diff options
| author | Martin Rudalics | 2011-01-21 21:44:53 -0500 |
|---|---|---|
| committer | Chong Yidong | 2011-01-21 21:44:53 -0500 |
| commit | e6b84b30bc24e5df0e997af2863bc1f4a6c1bfd2 (patch) | |
| tree | c525e49943e4245fb7c9c821ac795ba3a237bb81 /src | |
| parent | 6e1dbaa90f509915b6282dc61a041e434e41cf29 (diff) | |
| download | emacs-e6b84b30bc24e5df0e997af2863bc1f4a6c1bfd2.tar.gz emacs-e6b84b30bc24e5df0e997af2863bc1f4a6c1bfd2.zip | |
Rework 2011-01-15 changes to window.c.
* src/window.c (select_window): New function.
(Fselect_window): Call it.
(inhibit_point_swap): Variable deleted.
(Fset_window_configuration): Call select_window directly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/window.c | 58 |
2 files changed, 39 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 26aab0d5b5f..725ec639eb7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-01-22 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.c (select_window): New function. | ||
| 4 | (Fselect_window): Call it. | ||
| 5 | (inhibit_point_swap): Variable deleted. | ||
| 6 | (Fset_window_configuration): Call select_window directly. | ||
| 7 | |||
| 1 | 2011-01-16 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2011-01-16 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * image.c (syms_of_image): Don't access XSYMBOL's internals directly. | 10 | * image.c (syms_of_image): Don't access XSYMBOL's internals directly. |
diff --git a/src/window.c b/src/window.c index 8b4324f2697..ffbc471f47a 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -85,6 +85,7 @@ static int foreach_window_1 P_ ((struct window *, | |||
| 85 | int (* fn) (struct window *, void *), | 85 | int (* fn) (struct window *, void *), |
| 86 | void *)); | 86 | void *)); |
| 87 | static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 87 | static Lisp_Object window_list_1 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
| 88 | static Lisp_Object select_window _P ((Lisp_Object, Lisp_Object, int)); | ||
| 88 | 89 | ||
| 89 | /* This is the window in which the terminal's cursor should | 90 | /* This is the window in which the terminal's cursor should |
| 90 | be left when nothing is being done with it. This must | 91 | be left when nothing is being done with it. This must |
| @@ -158,11 +159,6 @@ static int sequence_number; | |||
| 158 | 159 | ||
| 159 | static int window_initialized; | 160 | static int window_initialized; |
| 160 | 161 | ||
| 161 | /* Set in `set-window-configuration' to prevent "swapping out point" | ||
| 162 | in the old selected window. */ | ||
| 163 | |||
| 164 | static int inhibit_point_swap; | ||
| 165 | |||
| 166 | /* Hook to run when window config changes. */ | 162 | /* Hook to run when window config changes. */ |
| 167 | 163 | ||
| 168 | static Lisp_Object Qwindow_configuration_change_hook; | 164 | static Lisp_Object Qwindow_configuration_change_hook; |
| @@ -3585,21 +3581,16 @@ This function runs `window-scroll-functions' before running | |||
| 3585 | return Qnil; | 3581 | return Qnil; |
| 3586 | } | 3582 | } |
| 3587 | 3583 | ||
| 3588 | /* Note that selected_window can be nil when this is called from | 3584 | /* If select_window is called with inhibit_point_swap non-zero it will |
| 3589 | Fset_window_configuration. */ | 3585 | not store point of the old selected window's buffer back into that |
| 3586 | window's pointm slot. This is needed by Fset_window_configuration to | ||
| 3587 | avoid that the display routine is called with selected_window set to | ||
| 3588 | Qnil causing a subsequent crash. */ | ||
| 3590 | 3589 | ||
| 3591 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, | 3590 | static Lisp_Object |
| 3592 | doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. | 3591 | select_window (window, norecord, inhibit_point_swap) |
| 3593 | If WINDOW is not already selected, make WINDOW's buffer current | 3592 | Lisp_Object window, norecord; |
| 3594 | and make WINDOW the frame's selected window. Return WINDOW. | 3593 | int inhibit_point_swap; |
| 3595 | Optional second arg NORECORD non-nil means do not put this buffer | ||
| 3596 | at the front of the list of recently selected ones and do not | ||
| 3597 | make this window the most recently selected one. | ||
| 3598 | |||
| 3599 | Note that the main editor command loop selects the buffer of the | ||
| 3600 | selected window before each command. */) | ||
| 3601 | (window, norecord) | ||
| 3602 | register Lisp_Object window, norecord; | ||
| 3603 | { | 3594 | { |
| 3604 | register struct window *w; | 3595 | register struct window *w; |
| 3605 | register struct window *ow; | 3596 | register struct window *ow; |
| @@ -3638,9 +3629,7 @@ selected window before each command. */) | |||
| 3638 | /* Store the current buffer's actual point into the | 3629 | /* Store the current buffer's actual point into the |
| 3639 | old selected window. It belongs to that window, | 3630 | old selected window. It belongs to that window, |
| 3640 | and when the window is not selected, must be in the window. */ | 3631 | and when the window is not selected, must be in the window. */ |
| 3641 | if (inhibit_point_swap) | 3632 | if (!inhibit_point_swap) |
| 3642 | inhibit_point_swap = 0; | ||
| 3643 | else | ||
| 3644 | { | 3633 | { |
| 3645 | ow = XWINDOW (selected_window); | 3634 | ow = XWINDOW (selected_window); |
| 3646 | if (! NILP (ow->buffer)) | 3635 | if (! NILP (ow->buffer)) |
| @@ -3676,6 +3665,26 @@ selected window before each command. */) | |||
| 3676 | return window; | 3665 | return window; |
| 3677 | } | 3666 | } |
| 3678 | 3667 | ||
| 3668 | |||
| 3669 | /* Note that selected_window can be nil when this is called from | ||
| 3670 | Fset_window_configuration. */ | ||
| 3671 | |||
| 3672 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, | ||
| 3673 | doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. | ||
| 3674 | If WINDOW is not already selected, make WINDOW's buffer current | ||
| 3675 | and make WINDOW the frame's selected window. Return WINDOW. | ||
| 3676 | Optional second arg NORECORD non-nil means do not put this buffer | ||
| 3677 | at the front of the list of recently selected ones and do not | ||
| 3678 | make this window the most recently selected one. | ||
| 3679 | |||
| 3680 | Note that the main editor command loop selects the buffer of the | ||
| 3681 | selected window before each command. */) | ||
| 3682 | (window, norecord) | ||
| 3683 | register Lisp_Object window, norecord; | ||
| 3684 | { | ||
| 3685 | select_window (window, norecord, 0); | ||
| 3686 | } | ||
| 3687 | |||
| 3679 | static Lisp_Object | 3688 | static Lisp_Object |
| 3680 | select_window_norecord (window) | 3689 | select_window_norecord (window) |
| 3681 | Lisp_Object window; | 3690 | Lisp_Object window; |
| @@ -6255,8 +6264,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6255 | out point" in the old selected window using the buffer that | 6264 | out point" in the old selected window using the buffer that |
| 6256 | has been restored into it. We already swapped out that point | 6265 | has been restored into it. We already swapped out that point |
| 6257 | from that window's old buffer. */ | 6266 | from that window's old buffer. */ |
| 6258 | inhibit_point_swap = 1; | 6267 | select_window (data->current_window, Qnil, 1); |
| 6259 | Fselect_window (data->current_window, Qnil); | ||
| 6260 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window | 6268 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
| 6261 | = selected_window; | 6269 | = selected_window; |
| 6262 | 6270 | ||
| @@ -7214,8 +7222,6 @@ syms_of_window () | |||
| 7214 | window_scroll_preserve_hpos = -1; | 7222 | window_scroll_preserve_hpos = -1; |
| 7215 | window_scroll_preserve_vpos = -1; | 7223 | window_scroll_preserve_vpos = -1; |
| 7216 | 7224 | ||
| 7217 | inhibit_point_swap = 0; | ||
| 7218 | |||
| 7219 | DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, | 7225 | DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, |
| 7220 | doc: /* Non-nil means call as function to display a help buffer. | 7226 | doc: /* Non-nil means call as function to display a help buffer. |
| 7221 | The function is called with one argument, the buffer to be displayed. | 7227 | The function is called with one argument, the buffer to be displayed. |