aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman2005-12-06 02:03:23 +0000
committerRichard M. Stallman2005-12-06 02:03:23 +0000
commit56ebfae2cab34fcc9bceb30d944256cfdac589ec (patch)
treecad98c85a0d676bd6800fc2541e8ba3c8334a489 /src
parent3ce5f932d93937fcb574c266c7766a902e0393a3 (diff)
downloademacs-56ebfae2cab34fcc9bceb30d944256cfdac589ec.tar.gz
emacs-56ebfae2cab34fcc9bceb30d944256cfdac589ec.zip
(enlarge_window): Eliminate arg preserve_before.
Assume it is 0. All callers changed. (Fenlarge_window, Fshrink_window): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/window.c96
1 files changed, 35 insertions, 61 deletions
diff --git a/src/window.c b/src/window.c
index e2659885f19..7c829d1fb89 100644
--- a/src/window.c
+++ b/src/window.c
@@ -65,7 +65,7 @@ static int window_min_size P_ ((struct window *, int, int, int *));
65static void size_window P_ ((Lisp_Object, int, int, int)); 65static void size_window P_ ((Lisp_Object, int, int, int));
66static int freeze_window_start P_ ((struct window *, void *)); 66static int freeze_window_start P_ ((struct window *, void *));
67static int window_fixed_size_p P_ ((struct window *, int, int)); 67static int window_fixed_size_p P_ ((struct window *, int, int));
68static void enlarge_window P_ ((Lisp_Object, int, int, int)); 68static void enlarge_window P_ ((Lisp_Object, int, int));
69static Lisp_Object window_list P_ ((void)); 69static Lisp_Object window_list P_ ((void));
70static int add_window_to_list P_ ((struct window *, void *)); 70static int add_window_to_list P_ ((struct window *, void *));
71static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, 71static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
@@ -3590,7 +3590,7 @@ displayed. */)
3590 + XFASTINT (XWINDOW (window)->total_lines)); 3590 + XFASTINT (XWINDOW (window)->total_lines));
3591 enlarge_window (upper, 3591 enlarge_window (upper,
3592 total / 2 - XFASTINT (XWINDOW (upper)->total_lines), 3592 total / 2 - XFASTINT (XWINDOW (upper)->total_lines),
3593 0, 0); 3593 0);
3594 } 3594 }
3595 } 3595 }
3596 } 3596 }
@@ -3881,21 +3881,18 @@ See Info node `(elisp)Splitting Windows' for more details and examples.*/)
3881 return new; 3881 return new;
3882} 3882}
3883 3883
3884DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 3, "p", 3884DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p",
3885 doc: /* Make current window ARG lines bigger. 3885 doc: /* Make current window ARG lines bigger.
3886From program, optional second arg non-nil means grow sideways ARG columns. 3886From program, optional second arg non-nil means grow sideways ARG columns.
3887Interactively, if an argument is not given, make the window one line bigger. 3887Interactively, if an argument is not given, make the window one line bigger.
3888If HORIZONTAL is non-nil, enlarge horizontally instead of vertically. 3888If HORIZONTAL is non-nil, enlarge horizontally instead of vertically.
3889 3889This function can delete windows, even the second window, if they get
3890Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size 3890too small. */)
3891of the siblings above or to the left of the selected window. Only 3891 (arg, horizontal)
3892siblings to the right or below are changed. */) 3892 Lisp_Object arg, horizontal;
3893 (arg, horizontal, preserve_before)
3894 register Lisp_Object arg, horizontal, preserve_before;
3895{ 3893{
3896 CHECK_NUMBER (arg); 3894 CHECK_NUMBER (arg);
3897 enlarge_window (selected_window, XINT (arg), !NILP (horizontal), 3895 enlarge_window (selected_window, XINT (arg), !NILP (horizontal));
3898 !NILP (preserve_before));
3899 3896
3900 if (! NILP (Vwindow_configuration_change_hook)) 3897 if (! NILP (Vwindow_configuration_change_hook))
3901 call1 (Vrun_hooks, Qwindow_configuration_change_hook); 3898 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
@@ -3903,20 +3900,16 @@ siblings to the right or below are changed. */)
3903 return Qnil; 3900 return Qnil;
3904} 3901}
3905 3902
3906DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 3, "p", 3903DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p",
3907 doc: /* Make current window ARG lines smaller. 3904 doc: /* Make current window ARG lines smaller.
3908From program, optional second arg non-nil means shrink sideways arg columns. 3905From program, optional second arg non-nil means shrink sideways arg columns.
3909Interactively, if an argument is not given, make the window one line smaller. 3906Interactively, if an argument is not given, make the window one line smaller. Only
3910
3911Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size
3912of the siblings above or to the left of the selected window. Only
3913siblings to the right or below are changed. */) 3907siblings to the right or below are changed. */)
3914 (arg, side, preserve_before) 3908 (arg, side)
3915 register Lisp_Object arg, side, preserve_before; 3909 Lisp_Object arg, side;
3916{ 3910{
3917 CHECK_NUMBER (arg); 3911 CHECK_NUMBER (arg);
3918 enlarge_window (selected_window, -XINT (arg), !NILP (side), 3912 enlarge_window (selected_window, -XINT (arg), !NILP (side));
3919 !NILP (preserve_before));
3920 3913
3921 if (! NILP (Vwindow_configuration_change_hook)) 3914 if (! NILP (Vwindow_configuration_change_hook))
3922 call1 (Vrun_hooks, Qwindow_configuration_change_hook); 3915 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
@@ -3954,15 +3947,12 @@ window_width (window)
3954 3947
3955 Siblings of the selected window are resized to fulfill the size 3948 Siblings of the selected window are resized to fulfill the size
3956 request. If they become too small in the process, they will be 3949 request. If they become too small in the process, they will be
3957 deleted. 3950 deleted. */
3958
3959 If PRESERVE_BEFORE is nonzero, that means don't alter
3960 the siblings to the left or above WINDOW. */
3961 3951
3962static void 3952static void
3963enlarge_window (window, delta, horiz_flag, preserve_before) 3953enlarge_window (window, delta, horiz_flag)
3964 Lisp_Object window; 3954 Lisp_Object window;
3965 int delta, horiz_flag, preserve_before; 3955 int delta, horiz_flag;
3966{ 3956{
3967 Lisp_Object parent, next, prev; 3957 Lisp_Object parent, next, prev;
3968 struct window *p; 3958 struct window *p;
@@ -4009,33 +3999,18 @@ enlarge_window (window, delta, horiz_flag, preserve_before)
4009 3999
4010 /* Compute the maximum size increment this window can have. */ 4000 /* Compute the maximum size increment this window can have. */
4011 4001
4012 if (preserve_before) 4002 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep)
4013 { 4003 /* This is a main window followed by a minibuffer. */
4014 if (!NILP (parent)) 4004 : !NILP (p->next) ? ((*sizefun) (p->next)
4015 { 4005 - window_min_size (XWINDOW (p->next),
4016 maxdelta = (*sizefun) (parent) - XINT (*sizep); 4006 horiz_flag, 0, 0))
4017 /* Subtract size of siblings before, since we can't take that. */ 4007 /* This is a minibuffer following a main window. */
4018 maxdelta -= XINT (CURBEG (window)) - XINT (CURBEG (parent)); 4008 : !NILP (p->prev) ? ((*sizefun) (p->prev)
4019 } 4009 - window_min_size (XWINDOW (p->prev),
4020 else 4010 horiz_flag, 0, 0))
4021 maxdelta = (!NILP (p->next) ? ((*sizefun) (p->next) 4011 /* This is a frame with only one window, a minibuffer-only
4022 - window_min_size (XWINDOW (p->next), 4012 or a minibufferless frame. */
4023 horiz_flag, 0, 0)) 4013 : (delta = 0));
4024 : (delta = 0));
4025 }
4026 else
4027 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep)
4028 /* This is a main window followed by a minibuffer. */
4029 : !NILP (p->next) ? ((*sizefun) (p->next)
4030 - window_min_size (XWINDOW (p->next),
4031 horiz_flag, 0, 0))
4032 /* This is a minibuffer following a main window. */
4033 : !NILP (p->prev) ? ((*sizefun) (p->prev)
4034 - window_min_size (XWINDOW (p->prev),
4035 horiz_flag, 0, 0))
4036 /* This is a frame with only one window, a minibuffer-only
4037 or a minibufferless frame. */
4038 : (delta = 0));
4039 4014
4040 if (delta > maxdelta) 4015 if (delta > maxdelta)
4041 /* This case traps trying to make the minibuffer 4016 /* This case traps trying to make the minibuffer
@@ -4058,10 +4033,9 @@ enlarge_window (window, delta, horiz_flag, preserve_before)
4058 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) 4033 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next)
4059 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), 4034 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next),
4060 horiz_flag, 0, 0); 4035 horiz_flag, 0, 0);
4061 if (! preserve_before) 4036 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev)
4062 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) 4037 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev),
4063 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), 4038 horiz_flag, 0, 0);
4064 horiz_flag, 0, 0);
4065 4039
4066 /* If we can get it all from them without deleting them, do so. */ 4040 /* If we can get it all from them without deleting them, do so. */
4067 if (delta <= maximum) 4041 if (delta <= maximum)
@@ -4077,7 +4051,7 @@ enlarge_window (window, delta, horiz_flag, preserve_before)
4077 moving away from this window in both directions alternately, 4051 moving away from this window in both directions alternately,
4078 and take as much as we can get without deleting that sibling. */ 4052 and take as much as we can get without deleting that sibling. */
4079 while (delta != 0 4053 while (delta != 0
4080 && (!NILP (next) || (!preserve_before && !NILP (prev)))) 4054 && (!NILP (next) || !NILP (prev)))
4081 { 4055 {
4082 if (! NILP (next)) 4056 if (! NILP (next))
4083 { 4057 {
@@ -4101,7 +4075,7 @@ enlarge_window (window, delta, horiz_flag, preserve_before)
4101 if (delta == 0) 4075 if (delta == 0)
4102 break; 4076 break;
4103 4077
4104 if (!preserve_before && ! NILP (prev)) 4078 if (! NILP (prev))
4105 { 4079 {
4106 int this_one = ((*sizefun) (prev) 4080 int this_one = ((*sizefun) (prev)
4107 - window_min_size (XWINDOW (prev), 4081 - window_min_size (XWINDOW (prev),
@@ -4350,7 +4324,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag)
4350DEFUN ("adjust-window-trailing-edge", Fadjust_window_trailing_edge, 4324DEFUN ("adjust-window-trailing-edge", Fadjust_window_trailing_edge,
4351 Sadjust_window_trailing_edge, 3, 3, 0, 4325 Sadjust_window_trailing_edge, 3, 3, 0,
4352 doc: /* Adjust the bottom or right edge of WINDOW by DELTA. 4326 doc: /* Adjust the bottom or right edge of WINDOW by DELTA.
4353If HORIZ_FLAG is t, that means adjust the width, moving the right edge. 4327If HORIZONTAL is non-nil, that means adjust the width, moving the right edge.
4354Otherwise, adjust the height, moving the bottom edge. 4328Otherwise, adjust the height, moving the bottom edge.
4355 4329
4356Following siblings of the selected window are resized to fulfill 4330Following siblings of the selected window are resized to fulfill
@@ -4602,7 +4576,7 @@ shrink_mini_window (w)
4602 among the other windows. */ 4576 among the other windows. */
4603 Lisp_Object window; 4577 Lisp_Object window;
4604 XSETWINDOW (window, w); 4578 XSETWINDOW (window, w);
4605 enlarge_window (window, 1 - XFASTINT (w->total_lines), 0, 0); 4579 enlarge_window (window, 1 - XFASTINT (w->total_lines), 0);
4606 } 4580 }
4607} 4581}
4608 4582