diff options
| author | Stefan Monnier | 2007-09-07 03:26:06 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-09-07 03:26:06 +0000 |
| commit | 90ab5c624d57d119dff33a5b9ae65e3b0c661d59 (patch) | |
| tree | 12f77ffd95efbb3799524021929d50252ac7d704 /src | |
| parent | 2317a7cfea5a0ad12ba5f9257182672932b6aea9 (diff) | |
| download | emacs-90ab5c624d57d119dff33a5b9ae65e3b0c661d59.tar.gz emacs-90ab5c624d57d119dff33a5b9ae65e3b0c661d59.zip | |
(Vsplit_window_preferred_function): New var.
(Fdisplay_buffer): Use it.
(syms_of_window): Export, and initialize it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/window.c | 24 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 86d84bb780c..7fc05c40994 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2007-09-07 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * window.c (Vsplit_window_preferred_function): New var. | ||
| 4 | (Fdisplay_buffer): Use it. | ||
| 5 | (syms_of_window): Export, and initialize it. | ||
| 6 | |||
| 1 | 2007-09-06 Pixel <pixel@mandriva.com> (tiny change) | 7 | 2007-09-06 Pixel <pixel@mandriva.com> (tiny change) |
| 2 | 8 | ||
| 3 | * image.c (gif_load): Fix bug: Handle nonexistent colormap. | 9 | * image.c (gif_load): Fix bug: Handle nonexistent colormap. |
diff --git a/src/window.c b/src/window.c index 3db1802a861..2b33bf5803d 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -192,6 +192,10 @@ Lisp_Object Qtemp_buffer_show_hook; | |||
| 192 | 192 | ||
| 193 | EMACS_INT split_height_threshold; | 193 | EMACS_INT split_height_threshold; |
| 194 | 194 | ||
| 195 | /* How to split windows (horizontally/vertically/hybrid). */ | ||
| 196 | |||
| 197 | Lisp_Object Vsplit_window_preferred_function; | ||
| 198 | |||
| 195 | /* Number of lines of continuity in scrolling by screenfuls. */ | 199 | /* Number of lines of continuity in scrolling by screenfuls. */ |
| 196 | 200 | ||
| 197 | EMACS_INT next_screen_context_lines; | 201 | EMACS_INT next_screen_context_lines; |
| @@ -3723,6 +3727,8 @@ displayed. */) | |||
| 3723 | || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated)) | 3727 | || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated)) |
| 3724 | { | 3728 | { |
| 3725 | Lisp_Object frames; | 3729 | Lisp_Object frames; |
| 3730 | struct gcpro gcpro1; | ||
| 3731 | GCPRO1 (buffer); | ||
| 3726 | 3732 | ||
| 3727 | frames = Qnil; | 3733 | frames = Qnil; |
| 3728 | if (FRAME_MINIBUF_ONLY_P (f)) | 3734 | if (FRAME_MINIBUF_ONLY_P (f)) |
| @@ -3758,14 +3764,14 @@ displayed. */) | |||
| 3758 | || (NILP (XWINDOW (window)->parent))) | 3764 | || (NILP (XWINDOW (window)->parent))) |
| 3759 | && (window_height (window) | 3765 | && (window_height (window) |
| 3760 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) | 3766 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) |
| 3761 | window = Fsplit_window (window, Qnil, Qnil); | 3767 | window = call1 (Vsplit_window_preferred_function, window); |
| 3762 | else | 3768 | else |
| 3763 | { | 3769 | { |
| 3764 | Lisp_Object upper, lower, other; | 3770 | Lisp_Object upper, lower, other; |
| 3765 | 3771 | ||
| 3766 | window = Fget_lru_window (frames, Qt); | 3772 | window = Fget_lru_window (frames, Qt); |
| 3767 | /* If the LRU window is tall enough, and either eligible for splitting | 3773 | /* If the LRU window is tall enough, and either eligible for |
| 3768 | and selected or the only window, split it. */ | 3774 | splitting and selected or the only window, split it. */ |
| 3769 | if (!NILP (window) | 3775 | if (!NILP (window) |
| 3770 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) | 3776 | && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
| 3771 | && ((EQ (window, selected_window) | 3777 | && ((EQ (window, selected_window) |
| @@ -3773,7 +3779,7 @@ displayed. */) | |||
| 3773 | || (NILP (XWINDOW (window)->parent))) | 3779 | || (NILP (XWINDOW (window)->parent))) |
| 3774 | && (window_height (window) | 3780 | && (window_height (window) |
| 3775 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) | 3781 | >= (2 * window_min_size_2 (XWINDOW (window), 0)))) |
| 3776 | window = Fsplit_window (window, Qnil, Qnil); | 3782 | window = call1 (Vsplit_window_preferred_function, window); |
| 3777 | else | 3783 | else |
| 3778 | window = Fget_lru_window (frames, Qnil); | 3784 | window = Fget_lru_window (frames, Qnil); |
| 3779 | /* If Fget_lru_window returned nil, try other approaches. */ | 3785 | /* If Fget_lru_window returned nil, try other approaches. */ |
| @@ -3819,6 +3825,7 @@ displayed. */) | |||
| 3819 | 0); | 3825 | 0); |
| 3820 | } | 3826 | } |
| 3821 | } | 3827 | } |
| 3828 | UNGCPRO; | ||
| 3822 | } | 3829 | } |
| 3823 | else | 3830 | else |
| 3824 | window = Fget_lru_window (Qnil, Qnil); | 3831 | window = Fget_lru_window (Qnil, Qnil); |
| @@ -7490,6 +7497,15 @@ by `display-buffer'. The value is in line units. | |||
| 7490 | If there is only one window, it is split regardless of this value. */); | 7497 | If there is only one window, it is split regardless of this value. */); |
| 7491 | split_height_threshold = 500; | 7498 | split_height_threshold = 500; |
| 7492 | 7499 | ||
| 7500 | DEFVAR_LISP ("split-window-preferred-function", | ||
| 7501 | &Vsplit_window_preferred_function, | ||
| 7502 | doc: /* Function to use to split a window. | ||
| 7503 | This is used by `display-buffer' to allow the user to choose whether | ||
| 7504 | to split windows horizontally or vertically or some mix of the two. | ||
| 7505 | It is called with a window as single argument and should split it in two | ||
| 7506 | and return the new window. */); | ||
| 7507 | Vsplit_window_preferred_function = intern ("split-window"); | ||
| 7508 | |||
| 7493 | DEFVAR_INT ("window-min-height", &window_min_height, | 7509 | DEFVAR_INT ("window-min-height", &window_min_height, |
| 7494 | doc: /* *Delete any window less than this tall (including its mode line). | 7510 | doc: /* *Delete any window less than this tall (including its mode line). |
| 7495 | The value is in line units. */); | 7511 | The value is in line units. */); |