(obj)
Lisp_Object obj;
{
- return XTYPE (obj) == Lisp_Window ? Qt : Qnil;
+ return WINDOWP (obj) ? Qt : Qnil;
}
DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0,
(obj)
Lisp_Object obj;
{
- return ((XTYPE (obj) == Lisp_Window
- && ! NILP (XWINDOW (obj)->buffer))
- ? Qt : Qnil);
+ return (WINDOWP (obj) && ! NILP (XWINDOW (obj)->buffer) ? Qt : Qnil);
}
Lisp_Object
Qnil);
XSETTYPE (val, Lisp_Window);
p = XWINDOW (val);
- XFASTINT (p->sequence_number) = ++sequence_number;
- XFASTINT (p->left) = XFASTINT (p->top)
- = XFASTINT (p->height) = XFASTINT (p->width)
- = XFASTINT (p->hscroll) = 0;
- XFASTINT (p->last_point_x) = XFASTINT (p->last_point_y) = 0;
+ XSETFASTINT (p->sequence_number, ++sequence_number);
+ XSETFASTINT (p->left, 0);
+ XSETFASTINT (p->top, 0);
+ XSETFASTINT (p->height, 0);
+ XSETFASTINT (p->width, 0);
+ XSETFASTINT (p->hscroll, 0);
+ XSETFASTINT (p->last_point_x, 0);
+ XSETFASTINT (p->last_point_y, 0);
p->start = Fmake_marker ();
p->pointm = Fmake_marker ();
- XFASTINT (p->use_time) = 0;
+ XSETFASTINT (p->use_time, 0);
p->frame = Qnil;
p->display_table = Qnil;
p->dedicated = Qnil;
{
#ifdef MULTI_FRAME
if (NILP (frame))
- XSET (frame, Lisp_Frame, selected_frame);
+ XSETFRAME (frame, selected_frame);
else
CHECK_LIVE_FRAME (frame, 0);
#endif
register struct window *w;
CHECK_NUMBER (ncol, 1);
- if (XINT (ncol) < 0) XFASTINT (ncol) = 0;
+ if (XINT (ncol) < 0) XSETFASTINT (ncol, 0);
if (XFASTINT (ncol) >= (1 << (SHORTBITS - 1)))
args_out_of_range (ncol, Qnil);
w = decode_window (window);
#ifdef MULTI_FRAME
if (NILP (frame))
- XSET (frame, Lisp_Frame, selected_frame);
+ XSETFRAME (frame, selected_frame);
else
CHECK_LIVE_FRAME (frame, 2);
#endif
return Qnil;
#endif
- XSET (value, Lisp_Int,
- BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
+ XSETINT (value,
+ BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos));
return value;
}
if (NILP (noforce))
w->force_start = Qt;
w->update_mode_line = Qt;
- XFASTINT (w->last_modified) = 0;
+ XSETFASTINT (w->last_modified, 0);
if (!EQ (window, selected_window))
windows_or_buffers_changed++;
return pos;
{
Lisp_Object tem;
tem = w->display_table;
- if (XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == DISP_TABLE_SIZE)
+ if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
return XVECTOR (tem);
tem = XBUFFER (w->buffer)->display_table;
- if (XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == DISP_TABLE_SIZE)
+ if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
return XVECTOR (tem);
tem = Vstandard_display_table;
- if (XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == DISP_TABLE_SIZE)
+ if (VECTORP (tem) && XVECTOR (tem)->size == DISP_TABLE_SIZE)
return XVECTOR (tem);
return 0;
}
If that happens, go back to the selected frame
so we can complete the cycle. */
if (EQ (tem, tem1))
- XSET (tem, Lisp_Frame, selected_frame);
+ XSETFRAME (tem, selected_frame);
}
#endif
tem = FRAME_ROOT_WINDOW (XFRAME (tem));
If that happens, go back to the selected frame
so we can complete the cycle. */
if (EQ (tem, tem1))
- XSET (tem, Lisp_Frame, selected_frame);
+ XSETFRAME (tem, selected_frame);
}
#endif
/* If this frame has a minibuffer, find that window first,
or Qt otherwise. */
/* Pick a window to start with. */
- if (XTYPE (obj) == Lisp_Window)
+ if (WINDOWP (obj))
w = obj;
else if (frame)
w = FRAME_SELECTED_WINDOW (frame);
Lisp_Object buffer, frame;
{
buffer = Fget_buffer (buffer);
- if (XTYPE (buffer) == Lisp_Buffer)
+ if (BUFFERP (buffer))
return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame);
else
return Qnil;
CHECK_LIVE_WINDOW (window, 0);
w = XWINDOW (window);
+
startpos = marker_position (w->start);
top = XFASTINT (w->top) - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w)));
+ if (MINI_WINDOW_P (w) && top > 0)
+ error ("Can't expand minibuffer to full frame");
+
window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w));
/* Try to minimize scrolling, by setting the window start to the point
return;
}
- XFASTINT (w->last_modified) = 0;
+ XSETFASTINT (w->last_modified, 0);
windows_or_buffers_changed++;
- XFASTINT (w->height) = height;
+ XSETFASTINT (w->height, height);
if (!NILP (w->hchild))
{
for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
opos = lastobot + XFASTINT (c->height);
- XFASTINT (c->top) = lastbot;
+ XSETFASTINT (c->top, lastbot);
pos = (((opos * height) << 1) + oheight) / (oheight << 1);
return;
}
- XFASTINT (w->last_modified) = 0;
+ XSETFASTINT (w->last_modified, 0);
windows_or_buffers_changed++;
- XFASTINT (w->width) = width;
+ XSETFASTINT (w->width, width);
if (!NILP (w->vchild))
{
for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
opos = lastoright + XFASTINT (c->width);
- XFASTINT (c->left) = lastright;
+ XSETFASTINT (c->left, lastright);
pos = (((opos * width) << 1) + owidth) / (owidth << 1);
}
w->buffer = buffer;
- w->window_end_pos = 0;
+ XSETFASTINT (w->window_end_pos, 0);
w->window_end_valid = Qnil;
- w->hscroll = 0;
+ XSETFASTINT(w->hscroll, 0);
Fset_marker (w->pointm,
make_number (BUF_PT (XBUFFER (buffer))),
buffer);
buffer);
w->start_at_line_beg = Qnil;
w->force_start = Qnil;
- XFASTINT (w->last_modified) = 0;
+ XSETFASTINT (w->last_modified, 0);
windows_or_buffers_changed++;
if (EQ (window, selected_window))
Fset_buffer (buffer);
if (NILP (w->buffer))
error ("Trying to select deleted window or non-leaf window");
- XFASTINT (w->use_time) = ++window_select_count;
+ XSETFASTINT (w->use_time, ++window_select_count);
if (EQ (window, selected_window))
return window;
if (!NILP (tem))
return call1 (Vspecial_display_function, buffer);
+ tem = Fassoc (XBUFFER (buffer)->name, Vspecial_display_buffer_names);
+ if (!NILP (tem))
+ return call2 (Vspecial_display_function, buffer, XCONS (tem)->cdr);
+
for (tem = Vspecial_display_regexps; CONSP (tem); tem = XCONS (tem)->cdr)
- if (fast_string_match (XCONS (tem)->car, XBUFFER (buffer)->name) >= 0)
- return call1 (Vspecial_display_function, buffer);
+ {
+ Lisp_Object car = XCONS (tem)->car;
+ if (STRINGP (car)
+ && fast_string_match (car, XBUFFER (buffer)->name) >= 0)
+ return call1 (Vspecial_display_function, buffer);
+ else if (CONSP (car)
+ && STRINGP (XCONS (car)->car)
+ && fast_string_match (XCONS (car)->car,
+ XBUFFER (buffer)->name) >= 0)
+ return call2 (Vspecial_display_function,
+ buffer,
+ XCONS (car)->cdr);
+ }
}
#ifdef MULTI_FRAME
frames = Qnil;
#ifdef MULTI_FRAME
if (FRAME_MINIBUF_ONLY_P (selected_frame))
- XSET (frames, Lisp_Frame, last_nonminibuf_frame);
+ XSETFRAME (frames, last_nonminibuf_frame);
#endif
/* Don't try to create a window if would get an error */
if (split_height_threshold < window_min_height << 1)
#endif /* MULTI_FRAME */
Vminibuf_scroll_window = window;
w = XWINDOW (window);
- XFASTINT (w->hscroll) = 0;
+ XSETFASTINT (w->hscroll, 0);
set_marker_restricted (w->start, make_number (1), buf);
set_marker_restricted (w->pointm, make_number (1), buf);
}
o = XWINDOW (old);
p = XWINDOW (new);
- XFASTINT (p->sequence_number) = ++sequence_number;
+ XSETFASTINT (p->sequence_number, ++sequence_number);
/* Put new into window structure in place of window */
replace_window (window, new);
{
p->height = o->height;
p->top = o->top;
- XFASTINT (p->width) = XFASTINT (o->width) - size;
- XFASTINT (o->width) = size;
- XFASTINT (p->left) = XFASTINT (o->left) + size;
+ XSETFASTINT (p->width, XFASTINT (o->width) - size);
+ XSETFASTINT (o->width, size);
+ XSETFASTINT (p->left, XFASTINT (o->left) + size);
}
else
{
p->left = o->left;
p->width = o->width;
- XFASTINT (p->height) = XFASTINT (o->height) - size;
- XFASTINT (o->height) = size;
- XFASTINT (p->top) = XFASTINT (o->top) + size;
+ XSETFASTINT (p->height, XFASTINT (o->height) - size);
+ XSETFASTINT (o->height, size);
+ XSETFASTINT (p->top, XFASTINT (o->top) + size);
}
return new;
(*setsizefun) (parent, opht, 0);
}
- XFASTINT (p->last_modified) = 0;
+ XSETFASTINT (p->last_modified, 0);
}
#undef MINSIZE
#undef CURBEG
/* Scroll bars occupy a few columns. */
if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
- return width - VERTICAL_SCROLL_BAR_WIDTH;
+ return width - FRAME_SCROLL_BAR_COLS (f);
/* The column of `|' characters separating side-by-side windows
occupies one column only. */
int lose;
Lisp_Object bolp, nmoved;
- XFASTINT (tem) = PT;
+ XSETFASTINT (tem, PT);
tem = Fpos_visible_in_window_p (tem, window);
if (NILP (tem))
{
Fvertical_motion (make_number (- (ht / 2)), window);
- XFASTINT (tem) = PT;
+ XSETFASTINT (tem, PT);
Fset_marker (w->start, tem, w->buffer);
w->force_start = Qt;
}
set_marker_restricted (w->start, make_number (pos), w->buffer);
w->start_at_line_beg = bolp;
w->update_mode_line = Qt;
- XFASTINT (w->last_modified) = 0;
+ XSETFASTINT (w->last_modified, 0);
if (pos > opoint)
SET_PT (pos);
if (n < 0)
window_scroll (window, next_screen_context_lines - ht, 1);
else
{
- if (XTYPE (n) == Lisp_Cons)
+ if (CONSP (n))
n = Fcar (n);
CHECK_NUMBER (n, 0);
window_scroll (window, XINT (n), 1);
{
if (NILP (arg))
- XFASTINT (arg) = window_internal_width (XWINDOW (selected_window)) - 2;
+ XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
else
arg = Fprefix_numeric_value (arg);
register Lisp_Object arg;
{
if (NILP (arg))
- XFASTINT (arg) = window_internal_width (XWINDOW (selected_window)) - 2;
+ XSETFASTINT (arg, window_internal_width (XWINDOW (selected_window)) - 2);
else
arg = Fprefix_numeric_value (arg);
{
register struct window *w = XWINDOW (selected_window);
register int ht = window_internal_height (w);
- register int opoint = PT;
+ struct position pos;
Lisp_Object window;
if (NILP (n))
extern int frame_garbaged;
SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w)));
- XFASTINT (n) = ht / 2;
+ XSETFASTINT (n, ht / 2);
}
- else if (XTYPE (n) == Lisp_Cons) /* Just C-u. */
+ else if (CONSP (n)) /* Just C-u. */
{
- XFASTINT (n) = ht / 2;
+ XSETFASTINT (n, ht / 2);
}
else
{
if (XINT (n) < 0)
XSETINT (n, XINT (n) + ht);
- XSETINT (n, - XINT (n));
-
- XSET (window, Lisp_Window, w);
- Fvertical_motion (n, window);
- Fset_marker (w->start, make_number (PT), w->buffer);
- w->start_at_line_beg = Fbolp ();
+ XSETWINDOW (window, w);
+ pos = *vmotion (point, - XINT (n), window_internal_width (w) - 1,
+ XINT (w->hscroll), window);
- SET_PT (opoint);
+ 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);
w->force_start = Qt;
return Qnil;
Lisp_Object window;
if (NILP (arg))
- XFASTINT (arg) = height / 2;
+ XSETFASTINT (arg, height / 2);
else
{
arg = Fprefix_numeric_value (arg);
}
start = marker_position (w->start);
- XSET (window, Lisp_Window, w);
+ XSETWINDOW (window, w);
if (start < BEGV || start > ZV)
{
Fvertical_motion (make_number (- (height / 2)), window);
Lisp_Object minibuf_scroll_window;
Lisp_Object root_window;
Lisp_Object focus_frame;
+ /* Record the values of window-min-width and window-min-height
+ so that window sizes remain consistent with them. */
+ Lisp_Object min_width, min_height;
/* A vector, interpreted as a struct saved_window */
Lisp_Object saved_windows;
};
(obj)
Lisp_Object obj;
{
- if (XTYPE (obj) == Lisp_Window_Configuration)
+ if (WINDOW_CONFIGURATIONP (obj))
return Qt;
return Qnil;
}
Lisp_Object frame;
FRAME_PTR f;
- while (XTYPE (configuration) != Lisp_Window_Configuration)
+ while (!WINDOW_CONFIGURATIONP (configuration))
{
configuration = wrong_type_argument (intern ("window-configuration-p"),
configuration);
windows_or_buffers_changed++;
+ /* Temporarily avoid any problems with windows that are smaller
+ than they are supposed to be. */
+ window_min_height = 1;
+ window_min_width = 1;
+
/* Kludge Alert!
Mark all windows now on frame as "deleted".
Restoring the new configuration "undeletes" any that are in it.
/* If we squirreled away the buffer in the window's height,
restore it now. */
- if (XTYPE (w->height) == Lisp_Buffer)
+ if (BUFFERP (w->height))
w->buffer = w->height;
w->left = p->left;
w->top = p->top;
w->height = p->height;
w->hscroll = p->hscroll;
w->display_table = p->display_table;
- XFASTINT (w->last_modified) = 0;
+ XSETFASTINT (w->last_modified, 0);
/* Reinstall the saved buffer and pointers into it. */
if (NILP (p->buffer))
#ifdef MULTI_FRAME
if (NILP (data->focus_frame)
- || (XTYPE (data->focus_frame) == Lisp_Frame
+ || (FRAMEP (data->focus_frame)
&& FRAME_LIVE_P (XFRAME (data->focus_frame))))
Fredirect_frame_focus (frame, data->focus_frame);
#endif
#endif
}
+ /* Restore the minimum heights recorded in the configuration. */
+ window_min_height = XINT (data->min_height);
+ window_min_width = XINT (data->min_width);
+
#ifdef MULTI_FRAME
/* Fselect_window will have made f the selected frame, so we
reselect the proper frame here. Fhandle_switch_frame will change the
p = SAVED_WINDOW_N (vector, i);
w = XWINDOW (window);
- XFASTINT (w->temslot) = i++;
+ XSETFASTINT (w->temslot, i++);
p->window = window;
p->buffer = w->buffer;
p->left = w->left;
data = (struct save_window_data *)
XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE),
Qnil));
- XFASTINT (data->frame_width) = FRAME_WIDTH (f);
- XFASTINT (data->frame_height) = FRAME_HEIGHT (f);
- XFASTINT (data->frame_menu_bar_lines) = FRAME_MENU_BAR_LINES (f);
+ 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
- XSET (data->selected_frame, Lisp_Frame, selected_frame);
+ XSETFRAME (data->selected_frame, selected_frame);
#endif
data->current_window = FRAME_SELECTED_WINDOW (f);
- XSET (data->current_buffer, Lisp_Buffer, current_buffer);
+ XSETBUFFER (data->current_buffer, current_buffer);
data->minibuf_scroll_window = Vminibuf_scroll_window;
data->root_window = FRAME_ROOT_WINDOW (f);
data->focus_frame = FRAME_FOCUS_FRAME (f);
+ XSETINT (data->min_height, window_min_height);
+ XSETINT (data->min_width, window_min_width);
tem = Fmake_vector (make_number (n_windows), Qnil);
data->saved_windows = tem;
for (i = 0; i < n_windows; i++)
= Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil);
save_window_save (FRAME_ROOT_WINDOW (f),
XVECTOR (tem), 0);
- XSET (tem, Lisp_Window_Configuration, data);
+ XSETWINDOW_CONFIGURATION (tem, data);
return (tem);
}
just so that there is "something there."
Correct values are put in in init_xdisp */
- XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width) = 10;
- XFASTINT (XWINDOW (minibuf_window)->width) = 10;
+ XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width, 10);
+ XSETFASTINT (XWINDOW (minibuf_window)->width, 10);
- XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height) = 9;
- XFASTINT (XWINDOW (minibuf_window)->top) = 9;
- XFASTINT (XWINDOW (minibuf_window)->height) = 1;
+ XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height, 9);
+ XSETFASTINT (XWINDOW (minibuf_window)->top, 9);
+ XSETFASTINT (XWINDOW (minibuf_window)->height, 1);
/* Prevent error in Fset_window_buffer. */
XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->buffer = Qt;
a newly-created, never-selected window. Increment
window_select_count so the first selection ever will get
something newer than this. */
- XFASTINT (XWINDOW (selected_window)->use_time) = ++window_select_count;
+ XSETFASTINT (XWINDOW (selected_window)->use_time, ++window_select_count);
#endif /* not MULTI_FRAME */
}
DEFVAR_LISP ("special-display-buffer-names", &Vspecial_display_buffer_names,
"*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'. See also `special-display-regexps'.");
+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\
+See also `special-display-regexps'.");
Vspecial_display_buffer_names = Qnil;
DEFVAR_LISP ("special-display-regexps", &Vspecial_display_regexps,
"*List of regexps saying which buffers should have their own special frames.\n\
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'. See also `special-display-buffer-names'.");
+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\
+See also `special-display-buffer-names'.");
Vspecial_display_regexps = Qnil;
DEFVAR_LISP ("special-display-function", &Vspecial_display_function,
"Function to call to make a new frame for a special buffer.\n\
-It is called with one argument, the buffer,\n\
-and should return a window displaying that buffer.\n\
+It is called with two arguments, the buffer and optional buffer specific\n\
+data, and should return a window displaying that buffer.\n\
The default value makes a separate frame for the buffer,\n\
-using `special-display-alist' to specify the frame parameters.\n\
+using `special-display-frame-alist' to specify the frame parameters.\n\
\n\
A buffer is special if its is listed in `special-display-buffer-names'\n\
or matches a regexp in `special-display-regexps'.");