aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJuri Linkov2008-03-29 23:05:26 +0000
committerJuri Linkov2008-03-29 23:05:26 +0000
commit7ae6d1d10e8a8ca2e816733f7ceb367a0b5dae57 (patch)
tree7f46476dee073f0991e909f2350c8c7514db9a0e /src/window.c
parentf1917c6f19b9386dfcd897d6aa7e001c101b05aa (diff)
downloademacs-7ae6d1d10e8a8ca2e816733f7ceb367a0b5dae57.tar.gz
emacs-7ae6d1d10e8a8ca2e816733f7ceb367a0b5dae57.zip
(Fdisplay_buffer): Move call to
Vsplit_window_preferred_function out of conditions that check if window is eligible for vertical splitting. When Vsplit_window_preferred_function is non-nil, call it and use its non-nil return value as window. Otherwise, continue doing vertical splitting using Fsplit_window with arg horflag=nil. (syms_of_window) <Vsplit_window_preferred_function>: Change the default value from `split-window' to nil.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/window.c b/src/window.c
index 8cf2a45e6f2..3b93a6fdc9f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3848,16 +3848,22 @@ displayed. */)
3848 else 3848 else
3849 window = Fget_largest_window (frames, Qt); 3849 window = Fget_largest_window (frames, Qt);
3850 3850
3851 /* If the largest window is tall enough, full-width, and either eligible 3851 if (!NILP (Vsplit_window_preferred_function))
3852 for splitting or the only window, split it. */ 3852 tem = call1 (Vsplit_window_preferred_function, window);
3853 if (!NILP (window) 3853
3854 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) 3854 if (!NILP (tem))
3855 && WINDOW_FULL_WIDTH_P (XWINDOW (window)) 3855 window = tem;
3856 && (window_height (window) >= split_height_threshold 3856 else
3857 || (NILP (XWINDOW (window)->parent))) 3857 /* If the largest window is tall enough, full-width, and either eligible
3858 && (window_height (window) 3858 for splitting or the only window, split it. */
3859 >= (2 * window_min_size_2 (XWINDOW (window), 0)))) 3859 if (!NILP (window)
3860 window = call1 (Vsplit_window_preferred_function, window); 3860 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
3861 && WINDOW_FULL_WIDTH_P (XWINDOW (window))
3862 && (window_height (window) >= split_height_threshold
3863 || (NILP (XWINDOW (window)->parent)))
3864 && (window_height (window)
3865 >= (2 * window_min_size_2 (XWINDOW (window), 0))))
3866 window = Fsplit_window (window, Qnil, Qnil);
3861 else 3867 else
3862 { 3868 {
3863 Lisp_Object upper, other; 3869 Lisp_Object upper, other;
@@ -3867,12 +3873,12 @@ displayed. */)
3867 splitting and selected or the only window, split it. */ 3873 splitting and selected or the only window, split it. */
3868 if (!NILP (window) 3874 if (!NILP (window)
3869 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) 3875 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
3870 && ((EQ (window, selected_window) 3876 && ((EQ (window, selected_window)
3871 && window_height (window) >= split_height_threshold) 3877 && window_height (window) >= split_height_threshold)
3872 || (NILP (XWINDOW (window)->parent))) 3878 || (NILP (XWINDOW (window)->parent)))
3873 && (window_height (window) 3879 && (window_height (window)
3874 >= (2 * window_min_size_2 (XWINDOW (window), 0)))) 3880 >= (2 * window_min_size_2 (XWINDOW (window), 0))))
3875 window = call1 (Vsplit_window_preferred_function, window); 3881 window = Fsplit_window (window, Qnil, Qnil);
3876 else 3882 else
3877 window = Fget_lru_window (frames, Qnil); 3883 window = Fget_lru_window (frames, Qnil);
3878 /* If Fget_lru_window returned nil, try other approaches. */ 3884 /* If Fget_lru_window returned nil, try other approaches. */
@@ -7596,9 +7602,12 @@ If there is only one window, it is split regardless of this value. */);
7596 doc: /* Function to use to split a window. 7602 doc: /* Function to use to split a window.
7597This is used by `display-buffer' to allow the user to choose whether 7603This is used by `display-buffer' to allow the user to choose whether
7598to split windows horizontally or vertically or some mix of the two. 7604to split windows horizontally or vertically or some mix of the two.
7605When this variable is nil, `display-buffer' splits windows vertically.
7606Otherwise, `display-buffer' calls this function to split a window.
7599It is called with a window as single argument and should split it in two 7607It is called with a window as single argument and should split it in two
7600and return the new window. */); 7608and return the new window, or return an appropriate existing window
7601 Vsplit_window_preferred_function = intern ("split-window"); 7609if splitting is not eligible. */);
7610 Vsplit_window_preferred_function = Qnil;
7602 7611
7603 DEFVAR_INT ("window-min-height", &window_min_height, 7612 DEFVAR_INT ("window-min-height", &window_min_height,
7604 doc: /* *Delete any window less than this tall (including its mode line). 7613 doc: /* *Delete any window less than this tall (including its mode line).