From: Stefan Monnier Date: Sat, 17 May 2003 21:19:55 +0000 (+0000) Subject: (Fselect_window): Add optional `norecord' arg. X-Git-Tag: ttn-vms-21-2-B4~10117 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=14d87dc9edddc9429c6d8ebc5a2226c5ab5fdcc9;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index f507196c38c..c6c89a01cc0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,41 @@ +2003-05-17 Stefan Monnier + + * window.c (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. + + * window.h (Fselect_window): Update declaration. + + * window.c (delete_window, Fother_window, Fset_window_configuration): + * minibuf.c (read_minibuf): + * macterm.c (x_new_focus_frame): + * frame.c (do_switch_frame, Fset_frame_selected_window, Fdelete_frame): + * callint.c (Fcall_interactively): + * xterm.c (x_new_focus_frame): Pass nil as new arg to Fselect_window. + + * buffer.c (Fpop_to_buffer): Pass norecord to Fselect_window. + 2003-05-17 David Kastrup * process.c (read_process_output): Back out change from 2003-03-09. +2003-05-17 Stefan Monnier + + * editfns.c (get_pos_property): Don't assume that `object' = nil. + + * textprop.c (text_property_stickiness): New arg `buffer'. + + * intervals.h (text_property_stickiness): New arg `buffer'. + (get_pos_property): Declare. + + * intervals.c (get_local_map): Use get_pos_property, to obey + stickiness and empty overlays. + (create_root_interval, graft_intervals_into_buffer): Use BEG. + (merge_properties, intervals_equal, merge_properties_sticky): + Use XCAR, XCDR. + (adjust_for_invis_intang): Pass new arg to text_property_stickiness. + 2003-05-17 Richard M. Stallman * minibuf.c (read_minibuf): If buffer is empty, record the default @@ -36,11 +70,10 @@ * alloc.c (Fgarbage_collect): Cast pointers into specpdl to avoid GCC warning. - + 2003-05-16 Ralph Schleicher (tiny change) - * fileio.c (Fdelete_file): Handle symlinks pointing to - directories. + * fileio.c (Fdelete_file): Handle symlinks pointing to directories. 2003-05-15 Stefan Monnier @@ -66,7 +99,7 @@ * bytecode.c: Include window.h. * emacs.c: Include window.h. - * keyboard.c (make_lispy_event): Apply modifiers to multibyte-char keys. + * keyboard.c (make_lispy_event): Apply modifiers to multibyte-char key. (keyremap): Add `parent' field. (keyremap_step): Use it. Remove `parent' argument. (read_key_sequence): Setup and use the new `parent' field. 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; static int displayed_window_lines P_ ((struct window *)); static struct window *decode_window P_ ((Lisp_Object)); -static Lisp_Object select_window_1 P_ ((Lisp_Object, int)); static int count_windows P_ ((struct window *)); static int get_leaf_windows P_ ((struct window *, struct window **, int)); static void window_scroll P_ ((Lisp_Object, int, int, int)); @@ -1299,7 +1298,7 @@ delete_window (window) delete the selected window on any other frame, we shouldn't do anything but set the frame's selected_window slot. */ if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) - Fselect_window (swindow); + Fselect_window (swindow, Qnil); else FRAME_SELECTED_WINDOW (f) = swindow; } @@ -1698,7 +1697,7 @@ argument ALL_FRAMES is non-nil, cycle through all frames. */) for (; i < 0; ++i) window = Fprevious_window (window, Qnil, all_frames); - Fselect_window (window); + Fselect_window (window, Qnil); return Qnil; } @@ -2782,26 +2781,17 @@ BUFFER can be a buffer or buffer name. */) return Qnil; } -DEFUN ("select-window", Fselect_window, Sselect_window, 1, 1, 0, +DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. If WINDOW is not already selected, also make WINDOW's buffer current. Also make WINDOW the frame's selected window. +Optional second arg NORECORD non-nil means +do not put this buffer at the front of the list of recently selected ones. Note that the main editor command loop selects the buffer of the selected window before each command. */) - (window) - register Lisp_Object window; -{ - return select_window_1 (window, 1); -} - -/* Note that selected_window can be nil - when this is called from Fset_window_configuration. */ - -static Lisp_Object -select_window_1 (window, recordflag) - register Lisp_Object window; - int recordflag; + (window, norecord) + register Lisp_Object window, norecord; { register struct window *w; register struct window *ow; @@ -2839,7 +2829,7 @@ select_window_1 (window, recordflag) else sf->selected_window = window; - if (recordflag) + if (NILP (norecord)) record_buffer (w->buffer); Fset_buffer (w->buffer); @@ -2863,6 +2853,13 @@ select_window_1 (window, recordflag) windows_or_buffers_changed++; return window; } + +static Lisp_Object +select_window_norecord (window) + Lisp_Object window; +{ + return Fselect_window (window, Qt); +} /* Deiconify the frame containing the window WINDOW, unless it is the selected frame; @@ -3205,18 +3202,19 @@ temp_output_buffer_show (buf) if (!NILP (tem)) { int count = SPECPDL_INDEX (); - Lisp_Object prev_window; + Lisp_Object prev_window, prev_buffer; prev_window = selected_window; - - /* Select the window that was chosen, for running the hook. */ - /* Both this Fselect_window and the select_window_1 - below will (may) incorrectly set-buffer to the buffer - displayed in the window. --stef */ - record_unwind_protect (Fselect_window, prev_window); - select_window_1 (window, 0); + XSETBUFFER (prev_buffer, old); + + /* Select the window that was chosen, for running the hook. + Note: Both Fselect_window and select_window_norecord may + set-buffer to the buffer displayed in the window, + so we need to save the current buffer. --stef */ + record_unwind_protect (Fset_buffer, prev_buffer); + record_unwind_protect (select_window_norecord, prev_window); + Fselect_window (window, Qt); Fset_buffer (w->buffer); call1 (Vrun_hooks, Qtemp_buffer_show_hook); - select_window_1 (prev_window, 0); unbind_to (count, Qnil); } } @@ -5220,7 +5218,7 @@ the return value is nil. Otherwise the value is t. */) make_number (old_point), XWINDOW (data->current_window)->buffer); - Fselect_window (data->current_window); + Fselect_window (data->current_window, Qnil); XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window = selected_window;