static struct window *decode_window P_ ((Lisp_Object));
+static Lisp_Object select_window_1 P_ ((Lisp_Object, int));
+
/* This is the window in which the terminal's cursor should
be left when nothing is being done with it. This must
always be a leaf window, and its buffer is selected by
if (NILP (XWINDOW (w)->parent))
{
Lisp_Object new_buffer;
- new_buffer = Fother_buffer (obj, Qnil);
+ new_buffer = Fother_buffer (obj, Qnil,
+ XWINDOW (w)->frame);
if (NILP (new_buffer))
new_buffer
= Fget_buffer_create (build_string ("*scratch*"));
/* Find another buffer to show in this window. */
Lisp_Object another_buffer;
FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w)));
- another_buffer = Fother_buffer (obj, Qnil);
+ another_buffer = Fother_buffer (obj, Qnil, XWINDOW (w)->frame);
if (NILP (another_buffer))
another_buffer
= Fget_buffer_create (build_string ("*scratch*"));
selects the buffer of the selected window before each command.")
(window)
register Lisp_Object window;
+{
+ return select_window_1 (window, 1);
+}
+\f
+static Lisp_Object
+select_window_1 (window, recordflag)
+ register Lisp_Object window;
+ int recordflag;
{
register struct window *w;
register struct window *ow = XWINDOW (selected_window);
else
selected_frame->selected_window = window;
- record_buffer (w->buffer);
+ if (recordflag)
+ record_buffer (w->buffer);
Fset_buffer (w->buffer);
XBUFFER (w->buffer)->last_selected_window = window;
windows_or_buffers_changed++;
return window;
}
-
+\f
/* Deiconify the frame containing the window WINDOW,
unless it is the selected frame;
then return WINDOW.
if (!NILP (tem))
{
int count = specpdl_ptr - specpdl;
+ Lisp_Object prev_window;
+ prev_window = selected_window;
/* Select the window that was chosen, for running the hook. */
record_unwind_protect (Fset_window_configuration,
Fcurrent_window_configuration (Qnil));
- Fselect_window (window);
+ select_window_1 (window, 0);
Fset_buffer (w->buffer);
call1 (Vrun_hooks, Qtemp_buffer_show_hook);
+ select_window_1 (prev_window, 0);
unbind_to (count, Qnil);
}
}