static void window_scroll_line_based P_ ((Lisp_Object, int, int, int));
static int window_min_size_1 P_ ((struct window *, int));
static int window_min_size P_ ((struct window *, int, int, int *));
-static void size_window P_ ((Lisp_Object, int, int, int));
+static void size_window P_ ((Lisp_Object, int, int, int, int, int));
static int freeze_window_start P_ ((struct window *, void *));
static int window_fixed_size_p P_ ((struct window *, int, int));
static void enlarge_window P_ ((Lisp_Object, int, int));
/* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set
WINDOW's width. Resize WINDOW's children, if any, so that they
- keep their proportionate size relative to WINDOW. Propagate
- WINDOW's top or left edge position to children. Delete windows
- that become too small unless NODELETE_P is non-zero.
+ keep their proportionate size relative to WINDOW.
+
+ If FIRST_ONLY is 1, change only the first of WINDOW's children when
+ they are in series. If LAST_ONLY is 1, change only the last of
+ WINDOW's children when they are in series.
+
+ Propagate WINDOW's top or left edge position to children. Delete
+ windows that become too small unless NODELETE_P is non-zero.
If NODELETE_P is 2, that means we do delete windows that are
too small, even if they were too small before! */
static void
-size_window (window, size, width_p, nodelete_p)
+size_window (window, size, width_p, nodelete_p, first_only, last_only)
Lisp_Object window;
int size, width_p, nodelete_p;
+ int first_only, last_only;
{
struct window *w = XWINDOW (window);
struct window *c;
if (!NILP (*sideward))
{
+ /* We have a chain of parallel siblings whose size should all change. */
for (child = *sideward; !NILP (child); child = c->next)
{
c = XWINDOW (child);
c->left_col = w->left_col;
else
c->top_line = w->top_line;
- size_window (child, size, width_p, nodelete_p);
+ size_window (child, size, width_p, nodelete_p,
+ first_only, last_only);
}
}
+ else if (!NILP (*forward) && last_only)
+ {
+ /* Change the last in a series of siblings. */
+ Lisp_Object last_child;
+ int child_size;
+
+ for (child = *forward; !NILP (child); child = c->next)
+ {
+ c = XWINDOW (child);
+ last_child = child;
+ }
+
+ child_size = XINT (width_p ? c->total_cols : c->total_lines);
+ size_window (last_child,
+ size - old_size + child_size,
+ width_p, nodelete_p, first_only, last_only);
+ }
+ else if (!NILP (*forward) && first_only)
+ {
+ /* Change the first in a series of siblings. */
+ int child_size;
+
+ child = *forward;
+ c = XWINDOW (child);
+
+ if (width_p)
+ c->left_col = w->left_col;
+ else
+ c->top_line = w->top_line;
+
+ child_size = XINT (width_p ? c->total_cols : c->total_lines);
+ size_window (child,
+ size - old_size + child_size,
+ width_p, nodelete_p, first_only, last_only);
+ }
else if (!NILP (*forward))
{
int fixed_size, each, extra, n;
int last_pos, first_pos, nchildren, total;
int *new_sizes = NULL;
- /* Determine the fixed-size portion of the this window, and the
+ /* Determine the fixed-size portion of this window, and the
number of child windows. */
fixed_size = nchildren = nfixed = total = 0;
for (child = *forward; !NILP (child); child = c->next, ++nchildren)
/* Set new height. Note that size_window also propagates
edge positions to children, so it's not a no-op if we
didn't change the child's size. */
- size_window (child, new_size, width_p, 1);
+ size_window (child, new_size, width_p, 1, first_only, last_only);
/* Remember the bottom/right edge position of this child; it
will be used to set the top/left edge of the next child. */
int child_size;
c = XWINDOW (child);
child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines);
- size_window (child, child_size, width_p, 2);
+ size_window (child, child_size, width_p, 2, first_only, last_only);
}
}
}
int height;
int nodelete;
{
- size_window (window, height, 0, nodelete);
+ size_window (window, height, 0, nodelete, 0, 0);
}
int width;
int nodelete;
{
- size_window (window, width, 1, nodelete);
+ size_window (window, width, 1, nodelete, 0, 0);
}
/* Change window heights in windows rooted in WINDOW by N lines. */
DEFUN ("force-window-update", Fforce_window_update, Sforce_window_update,
0, 1, 0,
- doc: /* Force redisplay of all windows.
+ doc: /* Force all windows to be updated on next redisplay.
If optional arg OBJECT is a window, force redisplay of that window only.
If OBJECT is a buffer or buffer name, force redisplay of all windows
displaying that buffer. */)
Interactively, all arguments are nil.
Returns the newly created window (which is the lower or rightmost one).
-The upper or leftmost window is the original one and remains selected.
+The upper or leftmost window is the original one, and remains selected
+if it was selected before.
+
See Info node `(elisp)Splitting Windows' for more details and examples.*/)
(window, size, horflag)
Lisp_Object window, size, horflag;
{
Lisp_Object first_parallel = Qnil;
- p = XWINDOW (window);
- parent = p->parent;
-
- if (NILP (XWINDOW (window)->next))
+ if (NILP (window))
{
+ /* This happens if WINDOW on the previous iteration was
+ at top level of the window tree. */
Fset_window_configuration (old_config);
- error ("No other window following this one");
+ error ("Specified window edge is fixed");
}
+ p = XWINDOW (window);
+ parent = p->parent;
+
/* See if this level has windows in parallel in the specified
direction. If so, set FIRST_PARALLEL to the first one. */
if (horiz_flag)
{
if (! NILP (parent) && !NILP (XWINDOW (parent)->vchild))
first_parallel = XWINDOW (parent)->vchild;
+ else if (NILP (parent) && !NILP (p->next))
+ {
+ /* Handle the vertical chain of main window and minibuffer
+ which has no parent. */
+ first_parallel = window;
+ while (! NILP (XWINDOW (first_parallel)->prev))
+ first_parallel = XWINDOW (first_parallel)->prev;
+ }
}
else
{
first_parallel = XWINDOW (parent)->hchild;
}
+ /* If this level's succession is in the desired dimension,
+ and this window is the last one, and there is no higher level,
+ its trailing edge is fixed. */
+ if (NILP (XWINDOW (window)->next) && NILP (first_parallel)
+ && NILP (parent))
+ {
+ Fset_window_configuration (old_config);
+ error ("Specified window edge is fixed");
+ }
+
/* Don't make this window too small. */
if (XINT (CURSIZE (window)) + delta
< (horiz_flag ? window_min_width : window_min_height))
we will fail and report an error, above.) */
if (NILP (first_parallel))
{
- if (!NILP (XWINDOW (window)->next))
+ if (!NILP (p->next))
{
/* This may happen for the minibuffer. In that case
the window_deletion_count check below does not work. */
XSETINT (CURBEG (p->next),
XINT (CURBEG (p->next)) + delta);
size_window (p->next, XINT (CURSIZE (p->next)) - delta,
- horiz_flag, 0);
+ horiz_flag, 0, 1, 0);
break;
}
}
child = XWINDOW (child)->next)
if (! EQ (child, window))
size_window (child, XINT (CURSIZE (child)) + delta,
- horiz_flag, 0);
+ horiz_flag, 0, 0, 1);
window = parent;
}
}
else if (noerror)
return;
+ else if (n < 0) /* could happen with empty buffers */
+ xsignal0 (Qbeginning_of_buffer);
else
- Fsignal (Qend_of_buffer, Qnil);
+ xsignal0 (Qend_of_buffer);
}
else
{
else if (noerror)
return;
else
- Fsignal (Qbeginning_of_buffer, Qnil);
+ xsignal0 (Qbeginning_of_buffer);
}
/* If control gets here, then we vscrolled. */
if (noerror)
return;
else
- Fsignal (Qbeginning_of_buffer, Qnil);
+ xsignal0 (Qbeginning_of_buffer);
}
if (pos < ZV)
if (noerror)
return;
else
- Fsignal (Qend_of_buffer, Qnil);
+ xsignal0 (Qend_of_buffer);
}
}
register struct save_window_data *data;
struct Lisp_Vector *saved_windows;
- if (! WINDOW_CONFIGURATIONP (config))
- wrong_type_argument (Qwindow_configuration_p, config);
+ CHECK_WINDOW_CONFIGURATION (config);
data = (struct save_window_data *) XVECTOR (config);
saved_windows = XVECTOR (data->saved_windows);
FRAME_PTR f;
int old_point = -1;
- while (!WINDOW_CONFIGURATIONP (configuration))
- wrong_type_argument (Qwindow_configuration_p, configuration);
+ CHECK_WINDOW_CONFIGURATION (configuration);
data = (struct save_window_data *) XVECTOR (configuration);
saved_windows = XVECTOR (data->saved_windows);
CHECK_NATNUM (left_width);
if (!NILP (right_width))
CHECK_NATNUM (right_width);
-
- if (!EQ (w->left_fringe_width, left_width)
- || !EQ (w->right_fringe_width, right_width)
- || !EQ (w->fringes_outside_margins, outside_margins))
+
+ /* Do nothing on a tty. */
+ if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
+ && (!EQ (w->left_fringe_width, left_width)
+ || !EQ (w->right_fringe_width, right_width)
+ || !EQ (w->fringes_outside_margins, outside_margins)))
{
w->left_fringe_width = left_width;
w->right_fringe_width = right_width;
Lisp_Object window;
{
struct window *w = decode_window (window);
+
return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
- Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ?
- Qt : Qnil), Qnil)));
+ Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
+ ? Qt : Qnil), Qnil)));
}
struct Lisp_Vector *sw1, *sw2;
int i;
- if (!WINDOW_CONFIGURATIONP (c1))
- wrong_type_argument (Qwindow_configuration_p, c1);
- if (!WINDOW_CONFIGURATIONP (c2))
- wrong_type_argument (Qwindow_configuration_p, c2);
+ CHECK_WINDOW_CONFIGURATION (c1);
+ CHECK_WINDOW_CONFIGURATION (c2);
d1 = (struct save_window_data *) XVECTOR (c1);
d2 = (struct save_window_data *) XVECTOR (c2);
next_screen_context_lines = 2;
DEFVAR_INT ("split-height-threshold", &split_height_threshold,
- doc: /* *A window must be at least this tall to be eligible for splitting by `display-buffer'.
+ doc: /* *A window must be at least this tall to be eligible for splitting
+by `display-buffer'. The value is in line units.
If there is only one window, it is split regardless of this value. */);
split_height_threshold = 500;
DEFVAR_INT ("window-min-height", &window_min_height,
- doc: /* *Delete any window less than this tall (including its mode line). */);
+ doc: /* *Delete any window less than this tall (including its mode line).
+The value is in line units. */);
window_min_height = 4;
DEFVAR_INT ("window-min-width", &window_min_width,
- doc: /* *Delete any window less than this wide. */);
+ doc: /* *Delete any window less than this wide (measured in characters). */);
window_min_width = 10;
DEFVAR_LISP ("scroll-preserve-screen-position",