[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: split-window-preferred-function
From: |
Juri Linkov |
Subject: |
Re: split-window-preferred-function |
Date: |
Sat, 22 Mar 2008 03:07:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
> I think we need to allow the function to return nil and in this case
> continue with the rest of the code. I.e. it should be possible to
> reproduce in Elisp what happens when split-window-preferred-function
> is nil. A good way to make sure that's true is to write the code in
> Elisp in the first place.
If I understand you correctly, this patch implements what you meant:
Index: src/window.c
===================================================================
RCS file: /sources/emacs/emacs/src/window.c,v
retrieving revision 1.604
diff -c -w -b -r1.604 window.c
*** src/window.c 19 Mar 2008 15:18:29 -0000 1.604
--- src/window.c 22 Mar 2008 01:07:04 -0000
***************
*** 3848,3853 ****
--- 3848,3859 ----
else
window = Fget_largest_window (frames, Qt);
+ if (!NILP (Vsplit_window_preferred_function))
+ tem = call1 (Vsplit_window_preferred_function, window);
+
+ if (!NILP (tem))
+ window = tem;
+ else
/* If the largest window is tall enough, full-width, and either eligible
for splitting or the only window, split it. */
if (!NILP (window)
***************
*** 3857,3863 ****
|| (NILP (XWINDOW (window)->parent)))
&& (window_height (window)
>= (2 * window_min_size_2 (XWINDOW (window), 0))))
! window = call1 (Vsplit_window_preferred_function, window);
else
{
Lisp_Object upper, other;
--- 3863,3869 ----
|| (NILP (XWINDOW (window)->parent)))
&& (window_height (window)
>= (2 * window_min_size_2 (XWINDOW (window), 0))))
! window = Fsplit_window (window, Qnil, Qnil);
else
{
Lisp_Object upper, other;
***************
*** 3872,3878 ****
|| (NILP (XWINDOW (window)->parent)))
&& (window_height (window)
>= (2 * window_min_size_2 (XWINDOW (window), 0))))
! window = call1 (Vsplit_window_preferred_function, window);
else
window = Fget_lru_window (frames, Qnil);
/* If Fget_lru_window returned nil, try other approaches. */
--- 3878,3884 ----
|| (NILP (XWINDOW (window)->parent)))
&& (window_height (window)
>= (2 * window_min_size_2 (XWINDOW (window), 0))))
! window = Fsplit_window (window, Qnil, Qnil);
else
window = Fget_lru_window (frames, Qnil);
/* If Fget_lru_window returned nil, try other approaches. */
***************
*** 7598,7604 ****
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).
--- 7604,7610 ----
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 = Qnil;
DEFVAR_INT ("window-min-height", &window_min_height,
doc: /* *Delete any window less than this tall (including its
mode line).
--
Juri Linkov
http://www.jurta.org/emacs/
- split-window-preferred-function, martin rudalics, 2008/03/19
- Re: split-window-preferred-function, Juri Linkov, 2008/03/20
- Re: split-window-preferred-function, Stefan Monnier, 2008/03/20
- Re: split-window-preferred-function,
Juri Linkov <=
- Re: split-window-preferred-function, Stefan Monnier, 2008/03/22
- Re: split-window-preferred-function, Juri Linkov, 2008/03/22
- Re: split-window-preferred-function, Juri Linkov, 2008/03/27
- Re: split-window-preferred-function, martin rudalics, 2008/03/28
- Re: split-window-preferred-function, Juri Linkov, 2008/03/28
- Re: split-window-preferred-function, martin rudalics, 2008/03/29
- Re: split-window-preferred-function, Juri Linkov, 2008/03/29
- Re: split-window-preferred-function, martin rudalics, 2008/03/29
- Re: split-window-preferred-function, Stefan Monnier, 2008/03/29
- Re: split-window-preferred-function, Richard Stallman, 2008/03/30