[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: split-window-preferred-function
From: |
David De La Harpe Golden |
Subject: |
Re: split-window-preferred-function |
Date: |
Wed, 02 Apr 2008 23:26:14 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.9 (X11/20080110) |
Tassilo Horn wrote:
> martin rudalics <address@hidden> writes:
>
> Hi Martin,
>
>> BTW, do we want a `split-width-threshold'?
>
> What would that do?
>
> Judging from the name I think it would inhibit splitting if the
> resulting window would be smaller than that threshold and reuse the
> least recently used window instead. I'd welcome such a feature (I
> usually don't want windows that are smaller than 80 columns), but
> wouldn't we need the same for height, too?
>
FWIW, I've currently got the following split-window-preferred function
in my .emacs I don't really know the details of the relevant emacs
internals, it just did roughly what I wanted, so I was happy.
(setq split-window-preferred-function
(lambda (window)
(let ((w (window-width window))
(h (window-height window))
(force-vert nil)
(w/h-ratio 2.0)) ; should be customizable.
;; Paranoia
(when (> 1 w) (setq w 1))
(when (> 1 h) (setq h 1))
(when (>= 160 w) (setq force-vert t))
(if (and (not force-vert)
(< (float w/h-ratio) (/ (float w) (float h))))
(split-window window nil 'horiz)
(split-window window)))))
Re: split-window-preferred-function, Stefan Monnier, 2008/04/02
Re: split-window-preferred-function, Juri Linkov, 2008/04/02
Re: split-window-preferred-function, Tassilo Horn, 2008/04/03