# HG changeset patch # User Stefan Monnier # Date 1189135566 0 # Node ID 7a92dcd56a24b1b61cad502a54767b024c8d2e3e # Parent 357b5ff720d49e5b756d7575c2db294c3b414a74 (Vsplit_window_preferred_function): New var. (Fdisplay_buffer): Use it. (syms_of_window): Export, and initialize it. diff -r 357b5ff720d4 -r 7a92dcd56a24 etc/NEWS --- a/etc/NEWS Fri Sep 07 02:53:10 2007 +0000 +++ b/etc/NEWS Fri Sep 07 03:26:06 2007 +0000 @@ -34,6 +34,9 @@ * Changes in Emacs 23.1 +** split-window-preferred-function specifies whether display-buffer should +split windows vertically or horizontally. + ** Support for multiple terminal devices and simultaneous graphical and tty frames has been added. You can test for the presence of this feature in your Lisp code by testing for the `multi-tty' feature. @@ -263,9 +266,10 @@ relevant to a specific terminal device. -** The function invisible-p returns non-nil if the character - after a specified position is invisible, or if its argument - as an `invisible' property would make a character invisible. +** You can now also pass the value of the `invisible' property to invisible-p +to check whether it would cause the text to be invisible. Convenient when +checking invisibility of text which has no buffer position +(e.g. in before/after-strings). ** Non-breaking space now acts as whitespace. diff -r 357b5ff720d4 -r 7a92dcd56a24 src/ChangeLog --- a/src/ChangeLog Fri Sep 07 02:53:10 2007 +0000 +++ b/src/ChangeLog Fri Sep 07 03:26:06 2007 +0000 @@ -1,3 +1,9 @@ +2007-09-07 Stefan Monnier + + * window.c (Vsplit_window_preferred_function): New var. + (Fdisplay_buffer): Use it. + (syms_of_window): Export, and initialize it. + 2007-09-06 Pixel (tiny change) * image.c (gif_load): Fix bug: Handle nonexistent colormap. diff -r 357b5ff720d4 -r 7a92dcd56a24 src/window.c --- 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. */);