diff options
| author | Eli Zaretskii | 2007-09-08 10:34:03 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2007-09-08 10:34:03 +0000 |
| commit | e01c1b527a0fb64cc3070d5ebe8df11da96e3fb6 (patch) | |
| tree | 854ecae93045cb5f9ee0ecd6440794e9e22f0953 /src/window.c | |
| parent | 5edcabcbc64650030045d5e889e825096736c4a3 (diff) | |
| download | emacs-e01c1b527a0fb64cc3070d5ebe8df11da96e3fb6.tar.gz emacs-e01c1b527a0fb64cc3070d5ebe8df11da96e3fb6.zip | |
(prefer_window_split_horizontally): New variable.
(display_buffer): Consider splitting window horizontally depending on
prefer_window_split_horizontally.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/src/window.c b/src/window.c index ae4c419cccd..a34c4200b7f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -163,6 +163,13 @@ Lisp_Object Vdisplay_buffer_function; | |||
| 163 | 163 | ||
| 164 | Lisp_Object Veven_window_heights; | 164 | Lisp_Object Veven_window_heights; |
| 165 | 165 | ||
| 166 | /* Non-nil means that windows are split horizontally, i.e. side-by-side, | ||
| 167 | instead of vertically by `display-buffer'. An integer value means that | ||
| 168 | windows may only be split horizontally if the newly created window is at | ||
| 169 | least as wide as that value. */ | ||
| 170 | |||
| 171 | Lisp_Object Vprefer_window_split_horizontally; | ||
| 172 | |||
| 166 | /* List of buffer *names* for buffers that should have their own frames. */ | 173 | /* List of buffer *names* for buffers that should have their own frames. */ |
| 167 | 174 | ||
| 168 | Lisp_Object Vspecial_display_buffer_names; | 175 | Lisp_Object Vspecial_display_buffer_names; |
| @@ -3653,7 +3660,12 @@ the buffer, it may be split, subject to the value of the variable | |||
| 3653 | 3660 | ||
| 3654 | If `even-window-heights' is non-nil, window heights will be evened out | 3661 | If `even-window-heights' is non-nil, window heights will be evened out |
| 3655 | if displaying the buffer causes two vertically adjacent windows to be | 3662 | if displaying the buffer causes two vertically adjacent windows to be |
| 3656 | displayed. */) | 3663 | displayed. |
| 3664 | |||
| 3665 | If `prefer-window-split-horizontally' is non-nil, windows are split | ||
| 3666 | horizontally, i.e. side-by-side, instead of vertically if possible. If the | ||
| 3667 | variable has an integer value, windows may only be split horizontally if the | ||
| 3668 | newly created window is at least as wide as that value. */) | ||
| 3657 | (buffer, not_this_window, frame) | 3669 | (buffer, not_this_window, frame) |
| 3658 | Lisp_Object buffer, not_this_window, frame; | 3670 | Lisp_Object buffer, not_this_window, frame; |
| 3659 | { | 3671 | { |
| @@ -3755,13 +3767,26 @@ displayed. */) | |||
| 3755 | else | 3767 | else |
| 3756 | window = Fget_largest_window (frames, Qt); | 3768 | window = Fget_largest_window (frames, Qt); |
| 3757 | 3769 | ||
| 3758 | /* If the largest window is tall enough, full-width, and either eligible | 3770 | /* If we prefer to split horizontally and the window is wide |
| 3759 | for splitting or the only window, split it. */ | 3771 | enough, split it horizontally. */ |
| 3760 | if (!NILP (window) | 3772 | if (!NILP (window) |
| 3761 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) | 3773 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
| 3762 | && WINDOW_FULL_WIDTH_P (XWINDOW (window)) | 3774 | && WINDOW_FULL_WIDTH_P (XWINDOW (window)) |
| 3763 | && (window_height (window) >= split_height_threshold | 3775 | && !NILP (Vprefer_window_split_horizontally) |
| 3764 | || (NILP (XWINDOW (window)->parent))) | 3776 | && (!NUMBERP (Vprefer_window_split_horizontally) || |
| 3777 | (window_width(window) >= | ||
| 3778 | 2 * XINT (Vprefer_window_split_horizontally))) | ||
| 3779 | && (window_width(window)) >= (2 * window_min_width)) | ||
| 3780 | { | ||
| 3781 | window = Fsplit_window (window, Qnil, Qt); | ||
| 3782 | } | ||
| 3783 | /* Else, if the largest window is tall enough, full-width, and either | ||
| 3784 | eligible for splitting or the only window, split it. */ | ||
| 3785 | else if (!NILP (window) | ||
| 3786 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) | ||
| 3787 | && WINDOW_FULL_WIDTH_P (XWINDOW (window)) | ||
| 3788 | && (window_height (window) >= split_height_threshold | ||
| 3789 | || (NILP (XWINDOW (window)->parent))) | ||
| 3765 | && (window_height (window) | 3790 | && (window_height (window) |
| 3766 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) | 3791 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) |
| 3767 | window = call1 (Vsplit_window_preferred_function, window); | 3792 | window = call1 (Vsplit_window_preferred_function, window); |
| @@ -3770,16 +3795,27 @@ displayed. */) | |||
| 3770 | Lisp_Object upper, lower, other; | 3795 | Lisp_Object upper, lower, other; |
| 3771 | 3796 | ||
| 3772 | window = Fget_lru_window (frames, Qt); | 3797 | window = Fget_lru_window (frames, Qt); |
| 3773 | /* If the LRU window is tall enough, and either eligible for | 3798 | /* If we prefer to split horizontally and the LRU window is |
| 3774 | splitting and selected or the only window, split it. */ | 3799 | wide enough, split it horizontally. */ |
| 3775 | if (!NILP (window) | 3800 | if (!NILP (window) |
| 3776 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) | 3801 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
| 3777 | && ((EQ (window, selected_window) | 3802 | && !NILP (Vprefer_window_split_horizontally) |
| 3778 | && window_height (window) >= split_height_threshold) | 3803 | && window_width(window) >= (2 * window_min_width) |
| 3779 | || (NILP (XWINDOW (window)->parent))) | 3804 | && (!NUMBERP (Vprefer_window_split_horizontally) || |
| 3780 | && (window_height (window) | 3805 | window_width(window) >= |
| 3781 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) | 3806 | (2 * XINT (Vprefer_window_split_horizontally)))) |
| 3782 | window = call1 (Vsplit_window_preferred_function, window); | 3807 | window = Fsplit_window (window, Qnil, Qt); |
| 3808 | /* Else if the LRU window is tall enough, and either | ||
| 3809 | eligible for splitting and selected, or the only window, | ||
| 3810 | split it. */ | ||
| 3811 | else if (!NILP (window) | ||
| 3812 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) | ||
| 3813 | && ((EQ (window, selected_window) | ||
| 3814 | && window_height (window) >= split_height_threshold) | ||
| 3815 | || (NILP (XWINDOW (window)->parent))) | ||
| 3816 | && (window_height (window) | ||
| 3817 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) | ||
| 3818 | window = Fsplit_window (window, Qnil, Qnil); | ||
| 3783 | else | 3819 | else |
| 3784 | window = Fget_lru_window (frames, Qnil); | 3820 | window = Fget_lru_window (frames, Qnil); |
| 3785 | /* If Fget_lru_window returned nil, try other approaches. */ | 3821 | /* If Fget_lru_window returned nil, try other approaches. */ |
| @@ -7354,6 +7390,14 @@ work using this function. */); | |||
| 7354 | If nil, `display-buffer' will leave the window configuration alone. */); | 7390 | If nil, `display-buffer' will leave the window configuration alone. */); |
| 7355 | Veven_window_heights = Qt; | 7391 | Veven_window_heights = Qt; |
| 7356 | 7392 | ||
| 7393 | DEFVAR_LISP ("prefer-window-split-horizontally", &Vprefer_window_split_horizontally, | ||
| 7394 | doc: /* *Non-nil means that windows are split horizontally, i.e. | ||
| 7395 | side-by-side, instead | ||
| 7396 | of vertically by `display-buffer'. | ||
| 7397 | An integer value means that windows may only be split horizontally if the newly | ||
| 7398 | created window is at least as wide as that value. */); | ||
| 7399 | Vprefer_window_split_horizontally = Qnil; | ||
| 7400 | |||
| 7357 | DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, | 7401 | DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window, |
| 7358 | doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll. */); | 7402 | doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll. */); |
| 7359 | Vminibuf_scroll_window = Qnil; | 7403 | Vminibuf_scroll_window = Qnil; |