Mercurial > emacs
diff src/window.c @ 84357:7a92dcd56a24
(Vsplit_window_preferred_function): New var.
(Fdisplay_buffer): Use it.
(syms_of_window): Export, and initialize it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 07 Sep 2007 03:26:06 +0000 |
parents | 5b644ae74c91 |
children | 584ae8393da8 |
line wrap: on
line diff
--- a/src/window.c Fri Sep 07 02:53:10 2007 +0000 +++ b/src/window.c Fri Sep 07 03:26:06 2007 +0000 @@ -192,6 +192,10 @@ EMACS_INT split_height_threshold; +/* How to split windows (horizontally/vertically/hybrid). */ + +Lisp_Object Vsplit_window_preferred_function; + /* Number of lines of continuity in scrolling by screenfuls. */ EMACS_INT next_screen_context_lines; @@ -3723,6 +3727,8 @@ || !NILP (XWINDOW (FRAME_ROOT_WINDOW (f))->dedicated)) { Lisp_Object frames; + struct gcpro gcpro1; + GCPRO1 (buffer); frames = Qnil; if (FRAME_MINIBUF_ONLY_P (f)) @@ -3758,14 +3764,14 @@ || (NILP (XWINDOW (window)->parent))) && (window_height (window) >= (2 * window_min_size_2 (XWINDOW (window), 0)))) - window = Fsplit_window (window, Qnil, Qnil); + window = call1 (Vsplit_window_preferred_function, window); else { Lisp_Object upper, lower, other; window = Fget_lru_window (frames, Qt); - /* If the LRU window is tall enough, and either eligible for splitting - and selected or the only window, split it. */ + /* If the LRU window is tall enough, and either eligible for + splitting and selected or the only window, split it. */ if (!NILP (window) && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) && ((EQ (window, selected_window) @@ -3773,7 +3779,7 @@ || (NILP (XWINDOW (window)->parent))) && (window_height (window) >= (2 * window_min_size_2 (XWINDOW (window), 0)))) - window = Fsplit_window (window, Qnil, Qnil); + window = call1 (Vsplit_window_preferred_function, window); else window = Fget_lru_window (frames, Qnil); /* If Fget_lru_window returned nil, try other approaches. */ @@ -3819,6 +3825,7 @@ 0); } } + UNGCPRO; } else window = Fget_lru_window (Qnil, Qnil); @@ -7490,6 +7497,15 @@ If there is only one window, it is split regardless of this value. */); split_height_threshold = 500; + DEFVAR_LISP ("split-window-preferred-function", + &Vsplit_window_preferred_function, + doc: /* Function to use to split a window. +This is used by `display-buffer' to allow the user to choose whether +to split windows horizontally or vertically or some mix of the two. +It is called with a window as single argument and should split it in two +and return the new window. */); + Vsplit_window_preferred_function = intern ("split-window"); + DEFVAR_INT ("window-min-height", &window_min_height, doc: /* *Delete any window less than this tall (including its mode line). The value is in line units. */);