diff options
| author | Stefan Monnier | 2003-05-17 21:19:55 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-05-17 21:19:55 +0000 |
| commit | 14d87dc9edddc9429c6d8ebc5a2226c5ab5fdcc9 (patch) | |
| tree | eb75125bdab1c42b23d67068fecd4cbe9a965a5e /src/window.c | |
| parent | f1321dc307e63c17ce838e0b32e2708fd351f1df (diff) | |
| download | emacs-14d87dc9edddc9429c6d8ebc5a2226c5ab5fdcc9.tar.gz emacs-14d87dc9edddc9429c6d8ebc5a2226c5ab5fdcc9.zip | |
(Fselect_window): Add optional `norecord' arg.
(select_window_1): Fold into Fselect_window.
(select_window_norecord): New function.
(temp_output_buffer_show): Use it. Preserve current buffer.
(delete_window, Fother_window, Fset_window_configuration):
Pass nil as new arg to Fselect_window.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/window.c b/src/window.c index 8b179cb29e9..22e66e4fbf1 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -55,7 +55,6 @@ extern Lisp_Object Qleft_margin, Qright_margin; | |||
| 55 | 55 | ||
| 56 | static int displayed_window_lines P_ ((struct window *)); | 56 | static int displayed_window_lines P_ ((struct window *)); |
| 57 | static struct window *decode_window P_ ((Lisp_Object)); | 57 | static struct window *decode_window P_ ((Lisp_Object)); |
| 58 | static Lisp_Object select_window_1 P_ ((Lisp_Object, int)); | ||
| 59 | static int count_windows P_ ((struct window *)); | 58 | static int count_windows P_ ((struct window *)); |
| 60 | static int get_leaf_windows P_ ((struct window *, struct window **, int)); | 59 | static int get_leaf_windows P_ ((struct window *, struct window **, int)); |
| 61 | static void window_scroll P_ ((Lisp_Object, int, int, int)); | 60 | static void window_scroll P_ ((Lisp_Object, int, int, int)); |
| @@ -1299,7 +1298,7 @@ delete_window (window) | |||
| 1299 | delete the selected window on any other frame, we shouldn't do | 1298 | delete the selected window on any other frame, we shouldn't do |
| 1300 | anything but set the frame's selected_window slot. */ | 1299 | anything but set the frame's selected_window slot. */ |
| 1301 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) | 1300 | if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) |
| 1302 | Fselect_window (swindow); | 1301 | Fselect_window (swindow, Qnil); |
| 1303 | else | 1302 | else |
| 1304 | FRAME_SELECTED_WINDOW (f) = swindow; | 1303 | FRAME_SELECTED_WINDOW (f) = swindow; |
| 1305 | } | 1304 | } |
| @@ -1698,7 +1697,7 @@ argument ALL_FRAMES is non-nil, cycle through all frames. */) | |||
| 1698 | for (; i < 0; ++i) | 1697 | for (; i < 0; ++i) |
| 1699 | window = Fprevious_window (window, Qnil, all_frames); | 1698 | window = Fprevious_window (window, Qnil, all_frames); |
| 1700 | 1699 | ||
| 1701 | Fselect_window (window); | 1700 | Fselect_window (window, Qnil); |
| 1702 | return Qnil; | 1701 | return Qnil; |
| 1703 | } | 1702 | } |
| 1704 | 1703 | ||
| @@ -2782,26 +2781,17 @@ BUFFER can be a buffer or buffer name. */) | |||
| 2782 | return Qnil; | 2781 | return Qnil; |
| 2783 | } | 2782 | } |
| 2784 | 2783 | ||
| 2785 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, | 2784 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, |
| 2786 | doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. | 2785 | doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. |
| 2787 | If WINDOW is not already selected, also make WINDOW's buffer current. | 2786 | If WINDOW is not already selected, also make WINDOW's buffer current. |
| 2788 | Also make WINDOW the frame's selected window. | 2787 | Also make WINDOW the frame's selected window. |
| 2788 | Optional second arg NORECORD non-nil means | ||
| 2789 | do not put this buffer at the front of the list of recently selected ones. | ||
| 2789 | 2790 | ||
| 2790 | Note that the main editor command loop | 2791 | Note that the main editor command loop |
| 2791 | selects the buffer of the selected window before each command. */) | 2792 | selects the buffer of the selected window before each command. */) |
| 2792 | (window) | 2793 | (window, norecord) |
| 2793 | register Lisp_Object window; | 2794 | register Lisp_Object window, norecord; |
| 2794 | { | ||
| 2795 | return select_window_1 (window, 1); | ||
| 2796 | } | ||
| 2797 | |||
| 2798 | /* Note that selected_window can be nil | ||
| 2799 | when this is called from Fset_window_configuration. */ | ||
| 2800 | |||
| 2801 | static Lisp_Object | ||
| 2802 | select_window_1 (window, recordflag) | ||
| 2803 | register Lisp_Object window; | ||
| 2804 | int recordflag; | ||
| 2805 | { | 2795 | { |
| 2806 | register struct window *w; | 2796 | register struct window *w; |
| 2807 | register struct window *ow; | 2797 | register struct window *ow; |
| @@ -2839,7 +2829,7 @@ select_window_1 (window, recordflag) | |||
| 2839 | else | 2829 | else |
| 2840 | sf->selected_window = window; | 2830 | sf->selected_window = window; |
| 2841 | 2831 | ||
| 2842 | if (recordflag) | 2832 | if (NILP (norecord)) |
| 2843 | record_buffer (w->buffer); | 2833 | record_buffer (w->buffer); |
| 2844 | Fset_buffer (w->buffer); | 2834 | Fset_buffer (w->buffer); |
| 2845 | 2835 | ||
| @@ -2863,6 +2853,13 @@ select_window_1 (window, recordflag) | |||
| 2863 | windows_or_buffers_changed++; | 2853 | windows_or_buffers_changed++; |
| 2864 | return window; | 2854 | return window; |
| 2865 | } | 2855 | } |
| 2856 | |||
| 2857 | static Lisp_Object | ||
| 2858 | select_window_norecord (window) | ||
| 2859 | Lisp_Object window; | ||
| 2860 | { | ||
| 2861 | return Fselect_window (window, Qt); | ||
| 2862 | } | ||
| 2866 | 2863 | ||
| 2867 | /* Deiconify the frame containing the window WINDOW, | 2864 | /* Deiconify the frame containing the window WINDOW, |
| 2868 | unless it is the selected frame; | 2865 | unless it is the selected frame; |
| @@ -3205,18 +3202,19 @@ temp_output_buffer_show (buf) | |||
| 3205 | if (!NILP (tem)) | 3202 | if (!NILP (tem)) |
| 3206 | { | 3203 | { |
| 3207 | int count = SPECPDL_INDEX (); | 3204 | int count = SPECPDL_INDEX (); |
| 3208 | Lisp_Object prev_window; | 3205 | Lisp_Object prev_window, prev_buffer; |
| 3209 | prev_window = selected_window; | 3206 | prev_window = selected_window; |
| 3210 | 3207 | XSETBUFFER (prev_buffer, old); | |
| 3211 | /* Select the window that was chosen, for running the hook. */ | 3208 | |
| 3212 | /* Both this Fselect_window and the select_window_1 | 3209 | /* Select the window that was chosen, for running the hook. |
| 3213 | below will (may) incorrectly set-buffer to the buffer | 3210 | Note: Both Fselect_window and select_window_norecord may |
| 3214 | displayed in the window. --stef */ | 3211 | set-buffer to the buffer displayed in the window, |
| 3215 | record_unwind_protect (Fselect_window, prev_window); | 3212 | so we need to save the current buffer. --stef */ |
| 3216 | select_window_1 (window, 0); | 3213 | record_unwind_protect (Fset_buffer, prev_buffer); |
| 3214 | record_unwind_protect (select_window_norecord, prev_window); | ||
| 3215 | Fselect_window (window, Qt); | ||
| 3217 | Fset_buffer (w->buffer); | 3216 | Fset_buffer (w->buffer); |
| 3218 | call1 (Vrun_hooks, Qtemp_buffer_show_hook); | 3217 | call1 (Vrun_hooks, Qtemp_buffer_show_hook); |
| 3219 | select_window_1 (prev_window, 0); | ||
| 3220 | unbind_to (count, Qnil); | 3218 | unbind_to (count, Qnil); |
| 3221 | } | 3219 | } |
| 3222 | } | 3220 | } |
| @@ -5220,7 +5218,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5220 | make_number (old_point), | 5218 | make_number (old_point), |
| 5221 | XWINDOW (data->current_window)->buffer); | 5219 | XWINDOW (data->current_window)->buffer); |
| 5222 | 5220 | ||
| 5223 | Fselect_window (data->current_window); | 5221 | Fselect_window (data->current_window, Qnil); |
| 5224 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window | 5222 | XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
| 5225 | = selected_window; | 5223 | = selected_window; |
| 5226 | 5224 | ||