[Top][All Lists]

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

Re: split-window-preferred-function

From: Tassilo Horn
Subject: Re: split-window-preferred-function
Date: Fri, 04 Apr 2008 12:04:00 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

Juri Linkov <address@hidden> writes:

> I don't see how this would help to decide whether to split a window
> vertically or horizontally, or to display a buffer in a new window.

The order of the splitting functions in the hypothetical
`split-window-functions' list would express the preference.  Each
function checks if it's applicable (wrt to
split-{width,height}-threshold) and returns nil, if it's not.

> For example:
> +----------------+--------------------------------+
> |                |                                |
> |   80 columns   |        160 columns             |
> |                |                                |
> |                |                                |
> |                |                                |
> |                |                                |
> +----------------+--------------------------------+
> When the right window is wide enough to be split horizontally, and
> point is in the left window, what is the best to do here?
> 1. display a buffer in the right window without splitting it;
> 2. split the wide right window horizontally and display a buffer
>    in a new window;
> 3. split the left window vertically (this option is preferable
>    for some buffers, e.g. for calendar)

By default I'd say the splitting functions only check if the current
window is wide/high enough.  So I the case above if horizontal splitting
is preferred and split-width-threshold is more than 40, the horizontal
splitting function would not be applicable and return nil.  The vertical
splitting function is the next and checks if the left window is higher
than split-height-threshold (the default should be changed to something
like 40).  If it is, then option 3 would be done.  If not, then it would
return nil, too.  In that case display-buffer would reuse the LRU window
which is the right one.

I think that's a sensible default.  Users are free to add other
functions.  For example the splitting functions could be extended to
search through all windows of the current frame to find one that's large
enough for a horizontal/vertical split.


reply via email to

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