/* Window creation, deletion and examination for GNU Emacs.
Does not include redisplay.
- Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
+ Copyright (C) 1985, 86, 87, 93, 94, 95 Free Software Foundation, Inc.
This file is part of GNU Emacs.
/* Function to pop up a special frame. */
Lisp_Object Vspecial_display_function;
+/* List of buffer *names* for buffers to appear in selected window. */
+Lisp_Object Vsame_window_buffer_names;
+
+/* List of regexps for buffer names to appear in selected window. */
+Lisp_Object Vsame_window_regexps;
+
+/* Hook run at end of temp_output_buffer_show. */
+Lisp_Object Qtemp_buffer_show_hook;
+
/* Fdisplay_buffer always splits the largest window
if that window is more than this high. */
int split_height_threshold;
Lisp_Object
make_window ()
{
- register Lisp_Object val;
+ Lisp_Object val;
register struct window *p;
-
- /* Add sizeof (Lisp_Object) here because sizeof (struct Lisp_Vector)
- includes the first element. */
- val = Fmake_vector (
- make_number ((sizeof (struct window) - sizeof (struct Lisp_Vector)
- + sizeof (Lisp_Object))
- / sizeof (Lisp_Object)),
- Qnil);
- XSETTYPE (val, Lisp_Window);
- p = XWINDOW (val);
+ register struct Lisp_Vector *vec;
+ int i;
+
+ vec = allocate_vectorlike ((EMACS_INT) VECSIZE (struct window));
+ for (i = 0; i < VECSIZE (struct window); i++)
+ vec->contents[i] = Qnil;
+ vec->size = VECSIZE (struct window);
+ p = (struct window *)vec;
XSETFASTINT (p->sequence_number, ++sequence_number);
XSETFASTINT (p->left, 0);
XSETFASTINT (p->top, 0);
p->frame = Qnil;
p->display_table = Qnil;
p->dedicated = Qnil;
+ XSETWINDOW (val, p);
return val;
}
return Qnil;
/* If that info is not correct, calculate afresh */
- posval = *compute_motion (top, 0, (hscroll ? 1 - hscroll : 0),
+ posval = *compute_motion (top, 0, (hscroll ? 1 - hscroll : 0), 0,
posint, height, 0,
window_internal_width (w) - 1,
hscroll, 0, w);
CHECK_NUMBER (ncol, 1);
if (XINT (ncol) < 0) XSETFASTINT (ncol, 0);
- if (XFASTINT (ncol) >= (1 << (SHORTBITS - 1)))
- args_out_of_range (ncol, Qnil);
w = decode_window (window);
if (XINT (w->hscroll) != XINT (ncol))
- clip_changed = 1; /* Prevent redisplay shortcuts */
+ XBUFFER (w->buffer)->clip_changed = 1; /* Prevent redisplay shortcuts */
w->hscroll = ncol;
return ncol;
}
+DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
+ Swindow_redisplay_end_trigger, 0, 1, 0,
+ "Return WINDOW's redisplay end trigger value.\n\
+See `set-window-redisplay-end-trigger' for more information.")
+ (window)
+ Lisp_Object window;
+{
+ return decode_window (window)->redisplay_end_trigger;
+}
+
+DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger,
+ Sset_window_redisplay_end_trigger, 2, 2, 0,
+ "Set WINDOW's redisplay end trigger value to VALUE.\n\
+VALUE should be a buffer position (typically a marker) or nil.\n\
+If it is a buffer position, then if redisplay in WINDOW reaches a position\n\
+beyond VALUE, the functions in `redisplay-end-trigger-functions' are called\n\
+with two arguments: WINDOW, and the end trigger value.\n\
+Afterwards the end-trigger value is reset to nil.")
+ (window, value)
+ register Lisp_Object window, value;
+{
+ register struct window *w;
+
+ w = decode_window (window);
+ w->redisplay_end_trigger = value;
+ return value;
+}
+
DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
"Return a list of the edge coordinates of WINDOW.\n\
\(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\
}
DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
- "Return position at which display currently starts in WINDOW.")
+ "Return position at which display currently starts in WINDOW.\n\
+This is updated by redisplay or by calling `set-window-start'.")
(window)
Lisp_Object window;
{
Ignore the specified tables if they are not valid;
if no valid table is specified, return 0. */
-struct Lisp_Vector *
+struct Lisp_Char_Table *
window_display_table (w)
struct window *w;
{
Lisp_Object tem;
tem = w->display_table;
- if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
- return XVECTOR (tem);
+ if (DISP_TABLE_P (tem))
+ return XCHAR_TABLE (tem);
tem = XBUFFER (w->buffer)->display_table;
- if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
- return XVECTOR (tem);
+ if (DISP_TABLE_P (tem))
+ return XCHAR_TABLE (tem);
tem = Vstandard_display_table;
- if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
- return XVECTOR (tem);
+ if (DISP_TABLE_P (tem))
+ return XCHAR_TABLE (tem);
return 0;
}
par = XWINDOW (parent);
windows_or_buffers_changed++;
+ FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (p))) = 1;
/* Are we trying to delete any frame's selected window? */
{
ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\
ALL-FRAMES = 0 means include windows on all visible and iconified frames.\n\
+If ALL-FRAMES is a frame, restrict search to windows on that frame.\n\
Anything else means restrict to WINDOW's frame.\n\
\n\
If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
/* minibuf == nil may or may not include minibuffers.
Decide if it does. */
if (NILP (minibuf))
- minibuf = (minibuf_level ? Qt : Qlambda);
+ minibuf = (minibuf_level ? minibuf_window : Qlambda);
+ else if (! EQ (minibuf, Qt))
+ minibuf = Qlambda;
+ /* Now minibuf can be t => count all minibuffer windows,
+ lambda => count none of them,
+ or a specific minibuffer window (the active one) to count. */
#ifdef MULTI_FRAME
/* all_frames == nil doesn't specify which frames to include. */
if (NILP (all_frames))
- all_frames = (EQ (minibuf, Qt)
+ all_frames = (! EQ (minibuf, Qlambda)
? (FRAME_MINIBUF_WINDOW
(XFRAME
(WINDOW_FRAME
;
else if (XFASTINT (all_frames) == 0)
;
+ else if (FRAMEP (all_frames) && ! EQ (all_frames, Fwindow_frame (window)))
+ /* If all_frames is a frame and window arg isn't on that frame, just
+ return the first window on the frame. */
+ return Fframe_first_window (all_frames);
else if (! EQ (all_frames, Qt))
all_frames = Qnil;
/* Now all_frames is t meaning search all frames,
}
/* Which windows are acceptible?
Exit the loop and accept this window if
- this isn't a minibuffer window, or
- we're accepting minibuffer windows, or
+ this isn't a minibuffer window,
+ or we're accepting all minibuffer windows,
+ or this is the active minibuffer and we are accepting that one, or
we've come all the way around and we're back at the original window. */
while (MINI_WINDOW_P (XWINDOW (window))
&& ! EQ (minibuf, Qt)
+ && ! EQ (minibuf, window)
&& ! EQ (window, start_window));
return window;
ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
above. ALL-FRAMES = `visible' means include windows on all visible frames.\n\
ALL-FRAMES = 0 means include windows on all visible and iconified frames.\n\
+If ALL-FRAMES is a frame, restrict search to windows on that frame.\n\
Anything else means restrict to WINDOW's frame.\n\
\n\
If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
/* minibuf == nil may or may not include minibuffers.
Decide if it does. */
if (NILP (minibuf))
- minibuf = (minibuf_level ? Qt : Qlambda);
+ minibuf = (minibuf_level ? minibuf_window : Qlambda);
+ else if (! EQ (minibuf, Qt))
+ minibuf = Qlambda;
+ /* Now minibuf can be t => count all minibuffer windows,
+ lambda => count none of them,
+ or a specific minibuffer window (the active one) to count. */
#ifdef MULTI_FRAME
/* all_frames == nil doesn't specify which frames to include.
Decide which frames it includes. */
if (NILP (all_frames))
- all_frames = (EQ (minibuf, Qt)
+ all_frames = (! EQ (minibuf, Qlambda)
? (FRAME_MINIBUF_WINDOW
(XFRAME
(WINDOW_FRAME
;
else if (XFASTINT (all_frames) == 0)
;
+ else if (FRAMEP (all_frames) && ! EQ (all_frames, Fwindow_frame (window)))
+ /* If all_frames is a frame and window arg isn't on that frame, just
+ return the first window on the frame. */
+ return Fframe_first_window (all_frames);
else if (! EQ (all_frames, Qt))
all_frames = Qnil;
/* Now all_frames is t meaning search all frames,
window = tem;
}
}
- /* Which windows are acceptable?
+ /* Which windows are acceptible?
Exit the loop and accept this window if
- this isn't a minibuffer window, or
- we're accepting minibuffer windows, or
+ this isn't a minibuffer window,
+ or we're accepting all minibuffer windows,
+ or this is the active minibuffer and we are accepting that one, or
we've come all the way around and we're back at the original window. */
while (MINI_WINDOW_P (XWINDOW (window))
- && !EQ (minibuf, Qt)
- && !EQ (window, start_window));
+ && ! EQ (minibuf, Qt)
+ && ! EQ (minibuf, window)
+ && ! EQ (window, start_window));
return window;
}
case DELETE_BUFFER_WINDOWS:
if (EQ (XWINDOW (w)->buffer, obj))
{
- /* If we're deleting the buffer displayed in the only window
- on the frame, find a new buffer to display there. */
- if (NILP (XWINDOW (w)->parent))
+#ifdef MULTI_FRAME
+ FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w)));
+
+ /* If this window is dedicated, and in a frame of its own,
+ kill the frame. */
+ if (EQ (w, FRAME_ROOT_WINDOW (f))
+ && !NILP (XWINDOW (w)->dedicated)
+ && other_visible_frames (f))
{
- Lisp_Object new_buffer;
- new_buffer = Fother_buffer (obj, Qnil);
- if (NILP (new_buffer))
- new_buffer
- = Fget_buffer_create (build_string ("*scratch*"));
- Fset_window_buffer (w, new_buffer);
- if (EQ (w, selected_window))
- Fset_buffer (XWINDOW (w)->buffer);
+ /* Skip the other windows on this frame.
+ There might be one, the minibuffer! */
+ if (! EQ (w, last_window))
+ while (f == XFRAME (WINDOW_FRAME (XWINDOW (next_window))))
+ {
+ /* As we go, check for the end of the loop.
+ We mustn't start going around a second time. */
+ if (EQ (next_window, last_window))
+ {
+ last_window = w;
+ break;
+ }
+ next_window = Fnext_window (next_window,
+ mini ? Qt : Qnil,
+ frame_arg);
+ }
+ /* Now we can safely delete the frame. */
+ Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil);
}
else
- Fdelete_window (w);
+#endif
+ /* If we're deleting the buffer displayed in the only window
+ on the frame, find a new buffer to display there. */
+ if (NILP (XWINDOW (w)->parent))
+ {
+ Lisp_Object new_buffer;
+ new_buffer = Fother_buffer (obj, Qnil);
+ if (NILP (new_buffer))
+ new_buffer
+ = Fget_buffer_create (build_string ("*scratch*"));
+ Fset_window_buffer (w, new_buffer);
+ if (EQ (w, selected_window))
+ Fset_buffer (XWINDOW (w)->buffer);
+ }
+ else
+ Fdelete_window (w);
}
break;
Fset_buffer (w->buffer);
/* This computation used to temporarily move point, but that can
have unwanted side effects due to text properties. */
- pos = *vmotion (startpos, -top, window_internal_width (w) - 1,
- XINT (w->hscroll), window);
+ pos = *vmotion (startpos, -top, w);
Fset_marker (w->start, make_number (pos.bufpos), w->buffer);
w->start_at_line_beg = ((pos.bufpos == BEGV
|| FETCH_CHAR (pos.bufpos - 1) == '\n') ? Qt
: Qnil);
+ /* We need to do this, so that the window-scroll-functions
+ get called. */
+ w->force_start = Qt;
set_buffer_internal (obuf);
}
XSETFASTINT (w->last_modified, 0);
windows_or_buffers_changed++;
+ FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1;
+
XSETFASTINT (w->height, height);
if (!NILP (w->hchild))
{
XSETFASTINT (w->last_modified, 0);
windows_or_buffers_changed++;
+ FRAME_WINDOW_SIZES_CHANGED (XFRAME (WINDOW_FRAME (w))) = 1;
+
XSETFASTINT (w->width, width);
if (!NILP (w->vchild))
{
return window;
}
+/* Deiconify the frame containing the window WINDOW, then return WINDOW. */
+
+static Lisp_Object
+display_buffer_1 (window)
+ Lisp_Object window;
+{
+#ifdef MULTI_FRAME
+ FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
+ FRAME_SAMPLE_VISIBILITY (f);
+ if (FRAME_ICONIFIED_P (f))
+ Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
+#endif
+ return window;
+}
+
DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 2,
- "BDisplay buffer: \nP",
+ "bDisplay buffer: \nP",
"Make BUFFER appear in some window but don't select it.\n\
BUFFER can be a buffer or a buffer name.\n\
If BUFFER is shown already in some window, just use that one,\n\
if (NILP (not_this_window)
&& XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
- return selected_window;
+ return display_buffer_1 (selected_window);
+
+ /* See if the user has specified this buffer should appear
+ in the selected window. */
+ if (NILP (not_this_window))
+ {
+ tem = Fmember (XBUFFER (buffer)->name, Vsame_window_buffer_names);
+ if (!NILP (tem))
+ {
+ Fswitch_to_buffer (buffer, Qnil);
+ return display_buffer_1 (selected_window);
+ }
+
+ tem = Fassoc (XBUFFER (buffer)->name, Vsame_window_buffer_names);
+ if (!NILP (tem))
+ {
+ Fswitch_to_buffer (buffer, Qnil);
+ return display_buffer_1 (selected_window);
+ }
+
+ for (tem = Vsame_window_regexps; CONSP (tem); tem = XCONS (tem)->cdr)
+ {
+ Lisp_Object car = XCONS (tem)->car;
+ if (STRINGP (car)
+ && fast_string_match (car, XBUFFER (buffer)->name) >= 0)
+ {
+ Fswitch_to_buffer (buffer, Qnil);
+ return display_buffer_1 (selected_window);
+ }
+ else if (CONSP (car)
+ && STRINGP (XCONS (car)->car)
+ && fast_string_match (XCONS (car)->car,
+ XBUFFER (buffer)->name) >= 0)
+ {
+ Fswitch_to_buffer (buffer, Qnil);
+ return display_buffer_1 (selected_window);
+ }
+ }
+ }
#ifdef MULTI_FRAME
/* If pop_up_frames,
- look for a window showing BUFFER on any visible or iconified frame. */
- window = Fget_buffer_window (buffer, pop_up_frames ? make_number (0) : Qnil);
-#else
- window = Fget_buffer_window (buffer, Qnil);
+ look for a window showing BUFFER on any visible or iconified frame.
+ Otherwise search only the current frame. */
+ if (pop_up_frames || last_nonminibuf_frame == 0)
+ XSETFASTINT (tem, 0);
+ else
#endif
+ XSETFRAME (tem, last_nonminibuf_frame);
+ window = Fget_buffer_window (buffer, tem);
if (!NILP (window)
&& (NILP (not_this_window) || !EQ (window, selected_window)))
{
-#ifdef MULTI_FRAME
- if (FRAME_ICONIFIED_P (XFRAME (WINDOW_FRAME (XWINDOW (window)))))
- Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
-#endif
- return window;
+ return display_buffer_1 (window);
}
/* Certain buffer names get special handling. */
{
window = Fframe_selected_window (call0 (Vpop_up_frame_function));
Fset_window_buffer (window, buffer);
- return window;
+ return display_buffer_1 (window);
}
#endif /* MULTI_FRAME */
#endif
/* If window appears above or below another,
even out their heights. */
+ other = upper = lower = Qnil;
if (!NILP (XWINDOW (window)->prev))
other = upper = XWINDOW (window)->prev, lower = window;
if (!NILP (XWINDOW (window)->next))
&& XWINDOW (other)->height > XWINDOW (window)->height)
{
int total = XWINDOW (other)->height + XWINDOW (window)->height;
- struct window *old_selected_window = selected_window;
+ Lisp_Object old_selected_window;
+ old_selected_window = selected_window;
- selected_window = XWINDOW (upper);
+ selected_window = upper;
change_window_height (total / 2 - XWINDOW (upper)->height, 0);
selected_window = old_selected_window;
}
window = Fget_lru_window (Qnil);
Fset_window_buffer (window, buffer);
- return window;
+ return display_buffer_1 (window);
}
void
register struct window *w;
Fset_buffer (buf);
- XBUFFER (buf)->save_modified = MODIFF;
+ BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
BEGV = BEG;
ZV = Z;
SET_PT (BEG);
- clip_changed = 1;
+ XBUFFER (buf)->clip_changed = 1;
set_buffer_internal (old);
if (!EQ (Vtemp_buffer_show_function, Qnil))
XSETFASTINT (w->hscroll, 0);
set_marker_restricted (w->start, make_number (1), buf);
set_marker_restricted (w->pointm, make_number (1), buf);
+
+ /* Run temp-buffer-show-hook, with the chosen window selected. */
+ if (!NILP (Vrun_hooks))
+ {
+ Lisp_Object tem;
+ tem = Fboundp (Qtemp_buffer_show_hook);
+ if (!NILP (tem))
+ {
+ tem = Fsymbol_value (Qtemp_buffer_show_hook);
+ if (!NILP (tem))
+ {
+ int count = specpdl_ptr - specpdl;
+
+ /* Select the window that was chosen, for running the hook. */
+ record_unwind_protect (Fset_window_configuration,
+ Fcurrent_window_configuration (Qnil));
+
+ Fselect_window (window);
+ call1 (Vrun_hooks, Qtemp_buffer_show_hook);
+ unbind_to (count, Qnil);
+ }
+ }
+ }
}
}
\f
make_dummy_parent (window)
Lisp_Object window;
{
- register Lisp_Object old, new;
+ Lisp_Object new;
register struct window *o, *p;
+ register struct Lisp_Vector *vec;
+ int i;
- old = window;
- XSETTYPE (old, Lisp_Vector);
- new = Fcopy_sequence (old);
- XSETTYPE (new, Lisp_Window);
+ o = XWINDOW (window);
+ vec = allocate_vectorlike ((EMACS_INT)VECSIZE (struct window));
+ for (i = 0; i < VECSIZE (struct window); ++i)
+ vec->contents[i] = ((struct Lisp_Vector *)o)->contents[i];
+ vec->size = VECSIZE (struct window);
+ p = (struct window *)vec;
+ XSETWINDOW (new, p);
- o = XWINDOW (old);
- p = XWINDOW (new);
XSETFASTINT (p->sequence_number, ++sequence_number);
/* Put new into window structure in place of window */
{
register Lisp_Object new;
register struct window *o, *p;
+ FRAME_PTR fo;
register int size;
+ int internal_width;
+ int separator_width = 1;
if (NILP (window))
window = selected_window;
CHECK_LIVE_WINDOW (window, 0);
o = XWINDOW (window);
+ fo = XFRAME (WINDOW_FRAME (o));
+ if (FRAME_HAS_VERTICAL_SCROLL_BARS (fo))
+ separator_width = FRAME_SCROLL_BAR_COLS (fo);
+ internal_width = window_internal_width (o);
if (NILP (chsize))
{
if (!NILP (horflag))
- /* Round odd size up, since this is for the left-hand window,
- and it will lose a column for the separators. */
- size = ((XFASTINT (o->width) + 1) & -2) >> 1;
+ /* Calculate the size of the left-hand window, by dividing
+ the usable space in columns by two. */
+ size = (internal_width - separator_width) >> 1;
else
size = XFASTINT (o->height) >> 1;
}
if (MINI_WINDOW_P (o))
error ("Attempt to split minibuffer window");
- else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o))))
+ else if (FRAME_NO_SPLIT_P (fo))
error ("Attempt to split unsplittable frame");
check_min_window_sizes ();
if (NILP (horflag))
{
- if (size < window_min_height
- || size + window_min_height > XFASTINT (o->height))
- args_out_of_range_3 (window, chsize, horflag);
+ if (size < window_min_height)
+ error ("Window height %d too small (after splitting)", size);
+ if (size + window_min_height > XFASTINT (o->height))
+ error ("Window height %d too small (after splitting)",
+ XFASTINT (o->height) - size);
if (NILP (o->parent)
|| NILP (XWINDOW (o->parent)->vchild))
{
}
else
{
- if (size < window_min_width
- || size + window_min_width > XFASTINT (o->width))
- args_out_of_range_3 (window, chsize, horflag);
+ if (size < window_min_width)
+ error ("Window width %d too small (after splitting)", size);
+ if (internal_width - size - separator_width < window_min_width)
+ error ("Window width %d too small (after splitting)",
+ internal_width - size - separator_width);
if (NILP (o->parent)
|| NILP (XWINDOW (o->parent)->hchild))
{
if we are making side-by-side windows */
windows_or_buffers_changed++;
+ FRAME_WINDOW_SIZES_CHANGED (fo) = 1;
new = make_window ();
p = XWINDOW (new);
{
p->height = o->height;
p->top = o->top;
- XSETFASTINT (p->width, XFASTINT (o->width) - size);
+ size += separator_width;
+ XSETFASTINT (p->width, internal_width - size);
XSETFASTINT (o->width, size);
XSETFASTINT (p->left, XFASTINT (o->left) + size);
}
int lose;
Lisp_Object bolp, nmoved;
+ /* Always set force_start so that redisplay_window will run
+ thw window-scroll-functions. */
+ w->force_start = Qt;
+
XSETFASTINT (tem, PT);
tem = Fpos_visible_in_window_p (tem, window);
Fvertical_motion (make_number (- (ht / 2)), window);
XSETFASTINT (tem, PT);
Fset_marker (w->start, tem, w->buffer);
- w->force_start = Qt;
}
SET_PT (marker_position (w->start));
register Lisp_Object n;
{
register Lisp_Object window;
- register int ht;
+ register int defalt;
register struct window *w;
register int count = specpdl_ptr - specpdl;
window = Fother_window_for_scrolling ();
w = XWINDOW (window);
- ht = window_internal_height (w);
+ defalt = window_internal_height (w) - next_screen_context_lines;
+ if (defalt < 1) defalt = 1;
/* Don't screw up if window_scroll gets an error. */
record_unwind_protect (save_excursion_restore, save_excursion_save ());
SET_PT (marker_position (w->pointm));
if (NILP (n))
- window_scroll (window, ht - next_screen_context_lines, 1);
+ window_scroll (window, defalt, 1);
else if (EQ (n, Qminus))
- window_scroll (window, next_screen_context_lines - ht, 1);
+ window_scroll (window, -defalt, 1);
else
{
if (CONSP (n))
register struct window *w = XWINDOW (selected_window);
register int ht = window_internal_height (w);
struct position pos;
- Lisp_Object window;
if (NILP (n))
{
if (XINT (n) < 0)
XSETINT (n, XINT (n) + ht);
- XSETWINDOW (window, w);
- pos = *vmotion (point, - XINT (n), window_internal_width (w) - 1,
- XINT (w->hscroll), window);
+ pos = *vmotion (point, - XINT (n), w);
Fset_marker (w->start, make_number (pos.bufpos), w->buffer);
w->start_at_line_beg = ((pos.bufpos == BEGV
Lisp_Object saved_windows;
};
-/* Arg to Fmake_vector */
-#define SAVE_WINDOW_DATA_SIZE \
- ((sizeof (struct save_window_data) \
- - (sizeof (struct Lisp_Vector) \
- /* Don't count the contents member of the struct Lisp_Vector */ \
- - sizeof (Lisp_Object))) \
- / sizeof (Lisp_Object))
-
/* This is saved as a Lisp_Vector */
struct saved_window
{
if (XFASTINT (data->frame_height) != previous_frame_height
|| XFASTINT (data->frame_width) != previous_frame_width)
change_frame_size (f, data->frame_height, data->frame_width, 0, 0);
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
if (XFASTINT (data->frame_menu_bar_lines)
!= previous_frame_menu_bar_lines)
x_set_menu_bar_lines (f, data->frame_menu_bar_lines, 0);
#endif
windows_or_buffers_changed++;
+ FRAME_WINDOW_SIZES_CHANGED (f) = 1;
/* Temporarily avoid any problems with windows that are smaller
than they are supposed to be. */
when the frame's old selected window has been deleted. */
#ifdef MULTI_FRAME
if (f != selected_frame && ! FRAME_TERMCAP_P (f))
- Fhandle_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)), Qnil);
+ do_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)),
+ Qnil, 0);
#endif
#endif
|| previous_frame_width != FRAME_WIDTH (f))
change_frame_size (f, previous_frame_height, previous_frame_width,
0, 0);
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f))
x_set_menu_bar_lines (f, previous_frame_menu_bar_lines, 0);
#endif
Fselect_window above totally superfluous; it still sets f's
selected window. */
if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
- Fhandle_switch_frame (data->selected_frame, Qnil);
+ do_switch_frame (data->selected_frame, Qnil, 0);
#endif
if (!NILP (new_current_buffer))
w->buffer);
}
else
- p->pointm = Fcopy_marker (w->pointm);
+ p->pointm = Fcopy_marker (w->pointm, Qnil);
- p->start = Fcopy_marker (w->start);
+ p->start = Fcopy_marker (w->start, Qnil);
p->start_at_line_beg = w->start_at_line_beg;
tem = XBUFFER (w->buffer)->mark;
- p->mark = Fcopy_marker (tem);
+ p->mark = Fcopy_marker (tem, Qnil);
}
else
{
register Lisp_Object tem;
register int n_windows;
register struct save_window_data *data;
+ register struct Lisp_Vector *vec;
register int i;
FRAME_PTR f;
}
n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
- data = (struct save_window_data *)
- XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE),
- Qnil));
+ vec = allocate_vectorlike (VECSIZE (struct save_window_data));
+ for (i = 0; i < VECSIZE (struct save_window_data); i++)
+ vec->contents[i] = Qnil;
+ vec->size = VECSIZE (struct save_window_data);
+ data = (struct save_window_data *)vec;
+
XSETFASTINT (data->frame_width, FRAME_WIDTH (f));
XSETFASTINT (data->frame_height, FRAME_HEIGHT (f));
XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f));
{
#ifdef MULTI_FRAME
selected_frame = make_terminal_frame ();
+ XSETFRAME (Vterminal_frame, selected_frame);
minibuf_window = selected_frame->minibuffer_window;
selected_window = selected_frame->selected_window;
last_nonminibuf_frame = selected_frame;
Qwindow_live_p = intern ("window-live-p");
staticpro (&Qwindow_live_p);
+ Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook");
+ staticpro (&Qtemp_buffer_show_hook);
+
#ifndef MULTI_FRAME
/* Make sure all windows get marked */
staticpro (&minibuf_window);
DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function,
"Non-nil means call as function to display a help buffer.\n\
-Used by `with-output-to-temp-buffer'.");
+The function is called with one argument, the buffer to be displayed.\n\
+Used by `with-output-to-temp-buffer'.\n\
+If this function is used, then it must do the entire job of showing\n\
+the buffer; `temp-buffer-show-hook' is not run unless this function runs it.");
Vtemp_buffer_show_function = Qnil;
DEFVAR_LISP ("display-buffer-function", &Vdisplay_buffer_function,
"*List of buffer names that should have their own special frames.\n\
Displaying a buffer whose name is in this list makes a special frame for it\n\
using `special-display-function'.\n\
-Instead of a buffer name, the list entries can be cons cells. In that\n\
-case the car should be a buffer name, and the cdr data to be passed as a
-second argument to `special-display-function'.\n\
+\n\
+An element of the list can be a cons cell instead of just a string.\n\
+Then the car should be a buffer name, and the cdr specifies frame\n\
+parameters for creating the frame for that buffer.\n\
+More precisely, the cdr is passed as the second argument to\n\
+the function found in `special-display-function', when making that frame.\n\
See also `special-display-regexps'.");
Vspecial_display_buffer_names = Qnil;
If a buffer name matches one of these regexps, it gets its own frame.\n\
Displaying a buffer whose name is in this list makes a special frame for it\n\
using `special-display-function'.\n\
-Instead of a buffer name, the list entries can be cons cells. In that\n\
-case the car should be the regexp, and the cdr data to be passed as a
-second argument to `special-display-function'.\n\
+\n\
+An element of the list can be a cons cell instead of just a string.\n\
+Then the car should be the regexp, and the cdr specifies frame\n\
+parameters for creating the frame for buffers that match.\n\
+More precisely, the cdr is passed as the second argument to\n\
+the function found in `special-display-function', when making that frame.\n\
See also `special-display-buffer-names'.");
Vspecial_display_regexps = Qnil;
or matches a regexp in `special-display-regexps'.");
Vspecial_display_function = Qnil;
+ DEFVAR_LISP ("same-window-buffer-names", &Vsame_window_buffer_names,
+ "*List of buffer names that should appear in the selected window.\n\
+Displaying one of these buffers using `display-buffer' or `pop-to-buffer'\n\
+switches to it in the selected window, rather than making it appear\n\
+in some other window.\n\
+\n\
+An element of the list can be a cons cell instead of just a string.\n\
+Then the car must be a string, which specifies the buffer name.\n\
+This is for compatibility with `special-display-buffer-names';\n\
+the cdr of the cons cell is ignored.\n\
+\n\
+See also `same-window-regexps'.");
+ Vsame_window_buffer_names = Qnil;
+
+ DEFVAR_LISP ("same-window-regexps", &Vsame_window_regexps,
+ "*List of regexps saying which buffers should appear in the selected window.\n\
+If a buffer name matches one of these regexps, then displaying it\n\
+using `display-buffer' or `pop-to-buffer' switches to it\n\
+in the selected window, rather than making it appear in some other window.\n\
+\n\
+An element of the list can be a cons cell instead of just a string.\n\
+Then the car must be a string, which specifies the buffer name.\n\
+This is for compatibility with `special-display-buffer-names';\n\
+the cdr of the cons cell is ignored.\n\
+\n\
+See also `same-window-buffer-names'.");
+ Vsame_window_regexps = Qnil;
+
DEFVAR_BOOL ("pop-up-windows", &pop_up_windows,
"*Non-nil means display-buffer should make new windows.");
pop_up_windows = 1;
defsubr (&Swindow_width);
defsubr (&Swindow_hscroll);
defsubr (&Sset_window_hscroll);
+ defsubr (&Swindow_redisplay_end_trigger);
+ defsubr (&Sset_window_redisplay_end_trigger);
defsubr (&Swindow_edges);
defsubr (&Scoordinates_in_window_p);
defsubr (&Swindow_at);