diff options
| author | Karoly Lorentey | 2005-12-10 21:18:28 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-12-10 21:18:28 +0000 |
| commit | 16986fcfcca94e88e620c38775e15f758aa44935 (patch) | |
| tree | 1006528b714927481dc4ef9e649efa10eee17433 /src/window.c | |
| parent | 9ef706664e98e37e9633712126bae99869904677 (diff) | |
| parent | e67f8828f5f9c4ba3697e048c6386c5e9c0c801e (diff) | |
| download | emacs-16986fcfcca94e88e620c38775e15f758aa44935.tar.gz emacs-16986fcfcca94e88e620c38775e15f758aa44935.zip | |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-664
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-665
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-666
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-447
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 118 |
1 files changed, 54 insertions, 64 deletions
diff --git a/src/window.c b/src/window.c index 2d974b4647f..dd80f629e1e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -67,7 +67,7 @@ static int window_min_size P_ ((struct window *, int, int, int *)); | |||
| 67 | static void size_window P_ ((Lisp_Object, int, int, int)); | 67 | static void size_window P_ ((Lisp_Object, int, int, int)); |
| 68 | static int freeze_window_start P_ ((struct window *, void *)); | 68 | static int freeze_window_start P_ ((struct window *, void *)); |
| 69 | static int window_fixed_size_p P_ ((struct window *, int, int)); | 69 | static int window_fixed_size_p P_ ((struct window *, int, int)); |
| 70 | static void enlarge_window P_ ((Lisp_Object, int, int, int)); | 70 | static void enlarge_window P_ ((Lisp_Object, int, int)); |
| 71 | static Lisp_Object window_list P_ ((void)); | 71 | static Lisp_Object window_list P_ ((void)); |
| 72 | static int add_window_to_list P_ ((struct window *, void *)); | 72 | static int add_window_to_list P_ ((struct window *, void *)); |
| 73 | static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 73 | static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| @@ -1971,7 +1971,7 @@ window_loop (type, obj, mini, frames) | |||
| 1971 | GCPRO1 (windows); | 1971 | GCPRO1 (windows); |
| 1972 | best_window = Qnil; | 1972 | best_window = Qnil; |
| 1973 | 1973 | ||
| 1974 | for (; CONSP (windows); windows = CDR (windows)) | 1974 | for (; CONSP (windows); windows = XCDR (windows)) |
| 1975 | { | 1975 | { |
| 1976 | struct window *w; | 1976 | struct window *w; |
| 1977 | 1977 | ||
| @@ -3592,7 +3592,7 @@ displayed. */) | |||
| 3592 | + XFASTINT (XWINDOW (window)->total_lines)); | 3592 | + XFASTINT (XWINDOW (window)->total_lines)); |
| 3593 | enlarge_window (upper, | 3593 | enlarge_window (upper, |
| 3594 | total / 2 - XFASTINT (XWINDOW (upper)->total_lines), | 3594 | total / 2 - XFASTINT (XWINDOW (upper)->total_lines), |
| 3595 | 0, 0); | 3595 | 0); |
| 3596 | } | 3596 | } |
| 3597 | } | 3597 | } |
| 3598 | } | 3598 | } |
| @@ -3669,7 +3669,7 @@ temp_output_buffer_show (buf) | |||
| 3669 | #endif | 3669 | #endif |
| 3670 | set_buffer_internal (old); | 3670 | set_buffer_internal (old); |
| 3671 | 3671 | ||
| 3672 | if (!EQ (Vtemp_buffer_show_function, Qnil)) | 3672 | if (!NILP (Vtemp_buffer_show_function)) |
| 3673 | call1 (Vtemp_buffer_show_function, buf); | 3673 | call1 (Vtemp_buffer_show_function, buf); |
| 3674 | else | 3674 | else |
| 3675 | { | 3675 | { |
| @@ -3883,21 +3883,18 @@ See Info node `(elisp)Splitting Windows' for more details and examples.*/) | |||
| 3883 | return new; | 3883 | return new; |
| 3884 | } | 3884 | } |
| 3885 | 3885 | ||
| 3886 | DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 3, "p", | 3886 | DEFUN ("enlarge-window", Fenlarge_window, Senlarge_window, 1, 2, "p", |
| 3887 | doc: /* Make current window ARG lines bigger. | 3887 | doc: /* Make current window ARG lines bigger. |
| 3888 | From program, optional second arg non-nil means grow sideways ARG columns. | 3888 | From program, optional second arg non-nil means grow sideways ARG columns. |
| 3889 | Interactively, if an argument is not given, make the window one line bigger. | 3889 | Interactively, if an argument is not given, make the window one line bigger. |
| 3890 | If HORIZONTAL is non-nil, enlarge horizontally instead of vertically. | 3890 | If HORIZONTAL is non-nil, enlarge horizontally instead of vertically. |
| 3891 | 3891 | This function can delete windows, even the second window, if they get | |
| 3892 | Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size | 3892 | too small. */) |
| 3893 | of the siblings above or to the left of the selected window. Only | 3893 | (arg, horizontal) |
| 3894 | siblings to the right or below are changed. */) | 3894 | Lisp_Object arg, horizontal; |
| 3895 | (arg, horizontal, preserve_before) | ||
| 3896 | register Lisp_Object arg, horizontal, preserve_before; | ||
| 3897 | { | 3895 | { |
| 3898 | CHECK_NUMBER (arg); | 3896 | CHECK_NUMBER (arg); |
| 3899 | enlarge_window (selected_window, XINT (arg), !NILP (horizontal), | 3897 | enlarge_window (selected_window, XINT (arg), !NILP (horizontal)); |
| 3900 | !NILP (preserve_before)); | ||
| 3901 | 3898 | ||
| 3902 | if (! NILP (Vwindow_configuration_change_hook)) | 3899 | if (! NILP (Vwindow_configuration_change_hook)) |
| 3903 | call1 (Vrun_hooks, Qwindow_configuration_change_hook); | 3900 | call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
| @@ -3905,20 +3902,16 @@ siblings to the right or below are changed. */) | |||
| 3905 | return Qnil; | 3902 | return Qnil; |
| 3906 | } | 3903 | } |
| 3907 | 3904 | ||
| 3908 | DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 3, "p", | 3905 | DEFUN ("shrink-window", Fshrink_window, Sshrink_window, 1, 2, "p", |
| 3909 | doc: /* Make current window ARG lines smaller. | 3906 | doc: /* Make current window ARG lines smaller. |
| 3910 | From program, optional second arg non-nil means shrink sideways arg columns. | 3907 | From program, optional second arg non-nil means shrink sideways arg columns. |
| 3911 | Interactively, if an argument is not given, make the window one line smaller. | 3908 | Interactively, if an argument is not given, make the window one line smaller. Only |
| 3912 | |||
| 3913 | Optional third arg PRESERVE-BEFORE, if non-nil, means do not change the size | ||
| 3914 | of the siblings above or to the left of the selected window. Only | ||
| 3915 | siblings to the right or below are changed. */) | 3909 | siblings to the right or below are changed. */) |
| 3916 | (arg, side, preserve_before) | 3910 | (arg, side) |
| 3917 | register Lisp_Object arg, side, preserve_before; | 3911 | Lisp_Object arg, side; |
| 3918 | { | 3912 | { |
| 3919 | CHECK_NUMBER (arg); | 3913 | CHECK_NUMBER (arg); |
| 3920 | enlarge_window (selected_window, -XINT (arg), !NILP (side), | 3914 | enlarge_window (selected_window, -XINT (arg), !NILP (side)); |
| 3921 | !NILP (preserve_before)); | ||
| 3922 | 3915 | ||
| 3923 | if (! NILP (Vwindow_configuration_change_hook)) | 3916 | if (! NILP (Vwindow_configuration_change_hook)) |
| 3924 | call1 (Vrun_hooks, Qwindow_configuration_change_hook); | 3917 | call1 (Vrun_hooks, Qwindow_configuration_change_hook); |
| @@ -3956,15 +3949,12 @@ window_width (window) | |||
| 3956 | 3949 | ||
| 3957 | Siblings of the selected window are resized to fulfill the size | 3950 | Siblings of the selected window are resized to fulfill the size |
| 3958 | request. If they become too small in the process, they will be | 3951 | request. If they become too small in the process, they will be |
| 3959 | deleted. | 3952 | deleted. */ |
| 3960 | |||
| 3961 | If PRESERVE_BEFORE is nonzero, that means don't alter | ||
| 3962 | the siblings to the left or above WINDOW. */ | ||
| 3963 | 3953 | ||
| 3964 | static void | 3954 | static void |
| 3965 | enlarge_window (window, delta, horiz_flag, preserve_before) | 3955 | enlarge_window (window, delta, horiz_flag) |
| 3966 | Lisp_Object window; | 3956 | Lisp_Object window; |
| 3967 | int delta, horiz_flag, preserve_before; | 3957 | int delta, horiz_flag; |
| 3968 | { | 3958 | { |
| 3969 | Lisp_Object parent, next, prev; | 3959 | Lisp_Object parent, next, prev; |
| 3970 | struct window *p; | 3960 | struct window *p; |
| @@ -4011,33 +4001,18 @@ enlarge_window (window, delta, horiz_flag, preserve_before) | |||
| 4011 | 4001 | ||
| 4012 | /* Compute the maximum size increment this window can have. */ | 4002 | /* Compute the maximum size increment this window can have. */ |
| 4013 | 4003 | ||
| 4014 | if (preserve_before) | 4004 | maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep) |
| 4015 | { | 4005 | /* This is a main window followed by a minibuffer. */ |
| 4016 | if (!NILP (parent)) | 4006 | : !NILP (p->next) ? ((*sizefun) (p->next) |
| 4017 | { | 4007 | - window_min_size (XWINDOW (p->next), |
| 4018 | maxdelta = (*sizefun) (parent) - XINT (*sizep); | 4008 | horiz_flag, 0, 0)) |
| 4019 | /* Subtract size of siblings before, since we can't take that. */ | 4009 | /* This is a minibuffer following a main window. */ |
| 4020 | maxdelta -= XINT (CURBEG (window)) - XINT (CURBEG (parent)); | 4010 | : !NILP (p->prev) ? ((*sizefun) (p->prev) |
| 4021 | } | 4011 | - window_min_size (XWINDOW (p->prev), |
| 4022 | else | 4012 | horiz_flag, 0, 0)) |
| 4023 | maxdelta = (!NILP (p->next) ? ((*sizefun) (p->next) | 4013 | /* This is a frame with only one window, a minibuffer-only |
| 4024 | - window_min_size (XWINDOW (p->next), | 4014 | or a minibufferless frame. */ |
| 4025 | horiz_flag, 0, 0)) | 4015 | : (delta = 0)); |
| 4026 | : (delta = 0)); | ||
| 4027 | } | ||
| 4028 | else | ||
| 4029 | maxdelta = (!NILP (parent) ? (*sizefun) (parent) - XINT (*sizep) | ||
| 4030 | /* This is a main window followed by a minibuffer. */ | ||
| 4031 | : !NILP (p->next) ? ((*sizefun) (p->next) | ||
| 4032 | - window_min_size (XWINDOW (p->next), | ||
| 4033 | horiz_flag, 0, 0)) | ||
| 4034 | /* This is a minibuffer following a main window. */ | ||
| 4035 | : !NILP (p->prev) ? ((*sizefun) (p->prev) | ||
| 4036 | - window_min_size (XWINDOW (p->prev), | ||
| 4037 | horiz_flag, 0, 0)) | ||
| 4038 | /* This is a frame with only one window, a minibuffer-only | ||
| 4039 | or a minibufferless frame. */ | ||
| 4040 | : (delta = 0)); | ||
| 4041 | 4016 | ||
| 4042 | if (delta > maxdelta) | 4017 | if (delta > maxdelta) |
| 4043 | /* This case traps trying to make the minibuffer | 4018 | /* This case traps trying to make the minibuffer |
| @@ -4060,10 +4035,9 @@ enlarge_window (window, delta, horiz_flag, preserve_before) | |||
| 4060 | for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) | 4035 | for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) |
| 4061 | maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), | 4036 | maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), |
| 4062 | horiz_flag, 0, 0); | 4037 | horiz_flag, 0, 0); |
| 4063 | if (! preserve_before) | 4038 | for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) |
| 4064 | for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) | 4039 | maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), |
| 4065 | maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), | 4040 | horiz_flag, 0, 0); |
| 4066 | horiz_flag, 0, 0); | ||
| 4067 | 4041 | ||
| 4068 | /* If we can get it all from them without deleting them, do so. */ | 4042 | /* If we can get it all from them without deleting them, do so. */ |
| 4069 | if (delta <= maximum) | 4043 | if (delta <= maximum) |
| @@ -4079,7 +4053,7 @@ enlarge_window (window, delta, horiz_flag, preserve_before) | |||
| 4079 | moving away from this window in both directions alternately, | 4053 | moving away from this window in both directions alternately, |
| 4080 | and take as much as we can get without deleting that sibling. */ | 4054 | and take as much as we can get without deleting that sibling. */ |
| 4081 | while (delta != 0 | 4055 | while (delta != 0 |
| 4082 | && (!NILP (next) || (!preserve_before && !NILP (prev)))) | 4056 | && (!NILP (next) || !NILP (prev))) |
| 4083 | { | 4057 | { |
| 4084 | if (! NILP (next)) | 4058 | if (! NILP (next)) |
| 4085 | { | 4059 | { |
| @@ -4103,7 +4077,7 @@ enlarge_window (window, delta, horiz_flag, preserve_before) | |||
| 4103 | if (delta == 0) | 4077 | if (delta == 0) |
| 4104 | break; | 4078 | break; |
| 4105 | 4079 | ||
| 4106 | if (!preserve_before && ! NILP (prev)) | 4080 | if (! NILP (prev)) |
| 4107 | { | 4081 | { |
| 4108 | int this_one = ((*sizefun) (prev) | 4082 | int this_one = ((*sizefun) (prev) |
| 4109 | - window_min_size (XWINDOW (prev), | 4083 | - window_min_size (XWINDOW (prev), |
| @@ -4352,7 +4326,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag) | |||
| 4352 | DEFUN ("adjust-window-trailing-edge", Fadjust_window_trailing_edge, | 4326 | DEFUN ("adjust-window-trailing-edge", Fadjust_window_trailing_edge, |
| 4353 | Sadjust_window_trailing_edge, 3, 3, 0, | 4327 | Sadjust_window_trailing_edge, 3, 3, 0, |
| 4354 | doc: /* Adjust the bottom or right edge of WINDOW by DELTA. | 4328 | doc: /* Adjust the bottom or right edge of WINDOW by DELTA. |
| 4355 | If HORIZ_FLAG is t, that means adjust the width, moving the right edge. | 4329 | If HORIZONTAL is non-nil, that means adjust the width, moving the right edge. |
| 4356 | Otherwise, adjust the height, moving the bottom edge. | 4330 | Otherwise, adjust the height, moving the bottom edge. |
| 4357 | 4331 | ||
| 4358 | Following siblings of the selected window are resized to fulfill | 4332 | Following siblings of the selected window are resized to fulfill |
| @@ -4604,7 +4578,7 @@ shrink_mini_window (w) | |||
| 4604 | among the other windows. */ | 4578 | among the other windows. */ |
| 4605 | Lisp_Object window; | 4579 | Lisp_Object window; |
| 4606 | XSETWINDOW (window, w); | 4580 | XSETWINDOW (window, w); |
| 4607 | enlarge_window (window, 1 - XFASTINT (w->total_lines), 0, 0); | 4581 | enlarge_window (window, 1 - XFASTINT (w->total_lines), 0); |
| 4608 | } | 4582 | } |
| 4609 | } | 4583 | } |
| 4610 | 4584 | ||
| @@ -5833,7 +5807,23 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5833 | else | 5807 | else |
| 5834 | { | 5808 | { |
| 5835 | if (XBUFFER (new_current_buffer) == current_buffer) | 5809 | if (XBUFFER (new_current_buffer) == current_buffer) |
| 5836 | old_point = PT; | 5810 | /* The code further down "preserves point" by saving here PT in |
| 5811 | old_point and then setting it later back into PT. When the | ||
| 5812 | current-selected-window and the final-selected-window both show | ||
| 5813 | the current buffer, this suffers from the problem that the | ||
| 5814 | current PT is the window-point of the current-selected-window, | ||
| 5815 | while the final PT is the point of the final-selected-window, so | ||
| 5816 | this copy from one PT to the other would end up moving the | ||
| 5817 | window-point of the final-selected-window to the window-point of | ||
| 5818 | the current-selected-window. So we have to be careful which | ||
| 5819 | point of the current-buffer we copy into old_point. */ | ||
| 5820 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | ||
| 5821 | && WINDOWP (selected_window) | ||
| 5822 | && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) | ||
| 5823 | && !EQ (selected_window, data->current_window)) | ||
| 5824 | old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; | ||
| 5825 | else | ||
| 5826 | old_point = PT; | ||
| 5837 | else | 5827 | else |
| 5838 | /* BUF_PT (XBUFFER (new_current_buffer)) gives us the position of | 5828 | /* BUF_PT (XBUFFER (new_current_buffer)) gives us the position of |
| 5839 | point in new_current_buffer as of the last time this buffer was | 5829 | point in new_current_buffer as of the last time this buffer was |