1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-02 11:21:42 +00:00

(Fenlarge_window): Rename SIDE to HORIZONTAL.

(enlarge_window): Rename WIDTHFLAG to HORIZ_FLAG.
(CURBEG, CURSIZE): Use HORIZ_FLAG instead of WIDTHFLAG.
This commit is contained in:
Richard M. Stallman 2005-11-03 21:13:57 +00:00
parent acebbab350
commit 5afc696a37

View File

@ -3872,15 +3872,16 @@ DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 3, "p",
doc: /* Make current window ARG lines bigger. doc: /* Make current window ARG lines bigger.
From program, optional second arg non-nil means grow sideways ARG columns. From program, optional second arg non-nil means grow sideways ARG columns.
Interactively, if an argument is not given, make the window one line bigger. Interactively, if an argument is not given, make the window one line bigger.
If HORIZONTAL is non-nil, enlarge horizontally instead of vertically.
Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size
of the siblings above or to the left of the selected window. Only of the siblings above or to the left of the selected window. Only
siblings to the right or below are changed. */) siblings to the right or below are changed. */)
(arg, side, preserve_before) (arg, horizontal, preserve_before)
register Lisp_Object arg, side, preserve_before; register Lisp_Object arg, horizontal, preserve_before;
{ {
CHECK_NUMBER (arg); CHECK_NUMBER (arg);
enlarge_window (selected_window, XINT (arg), !NILP (side), enlarge_window (selected_window, XINT (arg), !NILP (horizontal),
!NILP (preserve_before)); !NILP (preserve_before));
if (! NILP (Vwindow_configuration_change_hook)) if (! NILP (Vwindow_configuration_change_hook))
@ -3928,40 +3929,43 @@ window_width (window)
#define CURBEG(w) \ #define CURBEG(w) \
*(widthflag ? &(XWINDOW (w)->left_col) : &(XWINDOW (w)->top_line)) *(horiz_flag ? &(XWINDOW (w)->left_col) : &(XWINDOW (w)->top_line))
#define CURSIZE(w) \ #define CURSIZE(w) \
*(widthflag ? &(XWINDOW (w)->total_cols) : &(XWINDOW (w)->total_lines)) *(horiz_flag ? &(XWINDOW (w)->total_cols) : &(XWINDOW (w)->total_lines))
/* Enlarge WINDOW by DELTA. WIDTHFLAG non-zero means /* Enlarge WINDOW by DELTA.
increase its width. Siblings of the selected window are resized to HORIZ_FLAG nonzero means enlarge it horizontally;
fulfill the size request. If they become too small in the process, zero means do it vertically.
they will be deleted.
Siblings of the selected window are resized to fulfill the size
request. If they become too small in the process, they will be
deleted.
If PRESERVE_BEFORE is nonzero, that means don't alter If PRESERVE_BEFORE is nonzero, that means don't alter
the siblings to the left or above WINDOW. */ the siblings to the left or above WINDOW. */
static void static void
enlarge_window (window, delta, widthflag, preserve_before) enlarge_window (window, delta, horiz_flag, preserve_before)
Lisp_Object window; Lisp_Object window;
int delta, widthflag, preserve_before; int delta, horiz_flag, preserve_before;
{ {
Lisp_Object parent, next, prev; Lisp_Object parent, next, prev;
struct window *p; struct window *p;
Lisp_Object *sizep; Lisp_Object *sizep;
int maximum; int maximum;
int (*sizefun) P_ ((Lisp_Object)) int (*sizefun) P_ ((Lisp_Object))
= widthflag ? window_width : window_height; = horiz_flag ? window_width : window_height;
void (*setsizefun) P_ ((Lisp_Object, int, int)) void (*setsizefun) P_ ((Lisp_Object, int, int))
= (widthflag ? set_window_width : set_window_height); = (horiz_flag ? set_window_width : set_window_height);
/* Check values of window_min_width and window_min_height for /* Check values of window_min_width and window_min_height for
validity. */ validity. */
check_min_window_sizes (); check_min_window_sizes ();
/* Give up if this window cannot be resized. */ /* Give up if this window cannot be resized. */
if (window_fixed_size_p (XWINDOW (window), widthflag, 1)) if (window_fixed_size_p (XWINDOW (window), horiz_flag, 1))
error ("Window is not resizable"); error ("Window is not resizable");
/* Find the parent of the selected window. */ /* Find the parent of the selected window. */
@ -3972,12 +3976,12 @@ enlarge_window (window, delta, widthflag, preserve_before)
if (NILP (parent)) if (NILP (parent))
{ {
if (widthflag) if (horiz_flag)
error ("No other window to side of this one"); error ("No other window to side of this one");
break; break;
} }
if (widthflag if (horiz_flag
? !NILP (XWINDOW (parent)->hchild) ? !NILP (XWINDOW (parent)->hchild)
: !NILP (XWINDOW (parent)->vchild)) : !NILP (XWINDOW (parent)->vchild))
break; break;
@ -4003,7 +4007,7 @@ enlarge_window (window, delta, widthflag, preserve_before)
else else
maxdelta = (!NILP (p->next) ? ((*sizefun) (p->next) maxdelta = (!NILP (p->next) ? ((*sizefun) (p->next)
- window_min_size (XWINDOW (p->next), - window_min_size (XWINDOW (p->next),
widthflag, 0, 0)) horiz_flag, 0, 0))
: (delta = 0)); : (delta = 0));
} }
else else
@ -4011,11 +4015,11 @@ enlarge_window (window, delta, widthflag, preserve_before)
/* This is a main window followed by a minibuffer. */ /* This is a main window followed by a minibuffer. */
: !NILP (p->next) ? ((*sizefun) (p->next) : !NILP (p->next) ? ((*sizefun) (p->next)
- window_min_size (XWINDOW (p->next), - window_min_size (XWINDOW (p->next),
widthflag, 0, 0)) horiz_flag, 0, 0))
/* This is a minibuffer following a main window. */ /* This is a minibuffer following a main window. */
: !NILP (p->prev) ? ((*sizefun) (p->prev) : !NILP (p->prev) ? ((*sizefun) (p->prev)
- window_min_size (XWINDOW (p->prev), - window_min_size (XWINDOW (p->prev),
widthflag, 0, 0)) horiz_flag, 0, 0))
/* This is a frame with only one window, a minibuffer-only /* This is a frame with only one window, a minibuffer-only
or a minibufferless frame. */ or a minibufferless frame. */
: (delta = 0)); : (delta = 0));
@ -4027,7 +4031,7 @@ enlarge_window (window, delta, widthflag, preserve_before)
delta = maxdelta; delta = maxdelta;
} }
if (XINT (*sizep) + delta < window_min_size (XWINDOW (window), widthflag, 0, 0)) if (XINT (*sizep) + delta < window_min_size (XWINDOW (window), horiz_flag, 0, 0))
{ {
delete_window (window); delete_window (window);
return; return;
@ -4040,11 +4044,11 @@ enlarge_window (window, delta, widthflag, preserve_before)
maximum = 0; maximum = 0;
for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) for (next = p->next; ! NILP (next); next = XWINDOW (next)->next)
maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), maximum += (*sizefun) (next) - window_min_size (XWINDOW (next),
widthflag, 0, 0); horiz_flag, 0, 0);
if (! preserve_before) if (! preserve_before)
for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev)
maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev),
widthflag, 0, 0); horiz_flag, 0, 0);
/* If we can get it all from them without deleting them, do so. */ /* If we can get it all from them without deleting them, do so. */
if (delta <= maximum) if (delta <= maximum)
@ -4066,7 +4070,7 @@ enlarge_window (window, delta, widthflag, preserve_before)
{ {
int this_one = ((*sizefun) (next) int this_one = ((*sizefun) (next)
- window_min_size (XWINDOW (next), - window_min_size (XWINDOW (next),
widthflag, 0, &fixed_p)); horiz_flag, 0, &fixed_p));
if (!fixed_p) if (!fixed_p)
{ {
if (this_one > delta) if (this_one > delta)
@ -4088,7 +4092,7 @@ enlarge_window (window, delta, widthflag, preserve_before)
{ {
int this_one = ((*sizefun) (prev) int this_one = ((*sizefun) (prev)
- window_min_size (XWINDOW (prev), - window_min_size (XWINDOW (prev),
widthflag, 0, &fixed_p)); horiz_flag, 0, &fixed_p));
if (!fixed_p) if (!fixed_p)
{ {
if (this_one > delta) if (this_one > delta)
@ -4191,10 +4195,10 @@ enlarge_window (window, delta, widthflag, preserve_before)
int n = 1; int n = 1;
for (s = w->next; !NILP (s); s = XWINDOW (s)->next) for (s = w->next; !NILP (s); s = XWINDOW (s)->next)
if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0))
++n; ++n;
for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev) for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev)
if (!window_fixed_size_p (XWINDOW (s), widthflag, 0)) if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0))
++n; ++n;
delta1 = n * delta; delta1 = n * delta;