emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: prefer-window-split-horizontally


From: Tassilo Horn
Subject: Re: Patch: prefer-window-split-horizontally
Date: Thu, 16 Aug 2007 16:37:34 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

<address@hidden> writes:

Hi Klaus,

>>> If all/most current callers of this function would rather have it
>>> stay the way it is and if all callers that want it changed do not
>>> call it directly (or call it interactively), then we're better off
>>> changing the other place where split-window is called (i.e.
>>> display-buffer) or creating a new function.
>> 
>> I cannot follow you completely.  In most cases it's not the caller
>> who should decide how windows are split but the user, who wants to
>> use his screen as good as possible.
>> 
>> Beside Gnus and ECB I don't know any packages that have to care of
>> how windows have to be split.  And at least for Gnus I can say that
>> it does the split using all params `split-window' has, and thus
>> `split-window-function' wouldn't be used.
>
> If it's usefull for you, i can check this for ECB - can you please
> repeat exactly what i have to check! Then i can do this at weekend...

I suggested to change `split-window' so that it splits in a way the user
can configure by setting `split-window-function' to a function that
returns a symbol naming a function that should do the split, if and only
if split-window is called with zero or one (the WINDOW) argument.  So
calls to `split-window' that rely on the current behavior (that the
split will be vertically) are forced to use the additional parameters.

So if ECB relies on the current behavior, calls like

   (split-window window)

might not do what you expect if the user configured
`split-window-function'.

I grepped ECB's code and there are at least 4 places that would need to
be adapted.

./ecb-layout.el:2213:                       (setq window (split-window window))
./ecb-layout.el:2227:                           (setq window (split-window 
window)))
./ecb-layout.el:2955:                    (split-window (car 
(ecb-canonical-edit-windows-list)))))
./ecb-layout.el:2991:                    (split-window (car edit-win-list)))))
./ecb-layout.el:3757:   (call-interactively 'split-window)))

BTW: I see a problem with my approach.  I guess in elisp the calls

     (split-window window)

and

     (split-window window nil nil)

are equal and you cannot distinguish if nil was given explicitly or not,
right?

So maybe the HORFLAG argument should be changed to FLAG with possible
values 'horizontal and 'vertical, defaulting to 'horizontal.  I guess
that wouldn't break most current packages, because you normally wouldn't
give all args if they're nil.  Of course, calls like

     (split-window window size (want-horiz))

where the FLAG is calculated would need to be checked.

Bye,
Tassilo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]