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: Wed, 15 Aug 2007 17:49:36 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

"Davis Herring" <address@hidden> writes:

Hi Davis,

>> I think your approach would do that.  This example function would split
>> horizontally as long as all windows are 80 or more columns wide.
>>
>> --8<---------------cut here---------------start------------->8---
>> (defun th-split-window-function ()
>>   (save-window-excursion
>>     (save-excursion
>>       (split-window-horizontally)
>>       (balance-windows)
>>       (if (>= (let ((edges (window-edges))) (- (nth 2 edges) (nth 0
>> edges))) 80)
>>           'split-window-horizontally
>>         'split-window-vertically))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> Would you try to implement that?
>
> Splitting one window should not involve destroying all Lisp references
> to existing windows (as `save-window-excursion' must).  Unless
> redisplay would somehow be supressed here (I'm not sure), this would
> also involve calling `window-size-change-functions' twice for each
> split, which would be wasteful and perhaps confusing.

Is there another way to figure out how wide the windows that would
result from a horizontal split would be?

And if you want to avoid the problems you mentioned, you could go with:

--8<---------------cut here---------------start------------->8---
(defun th-split-window-function ()
  (if (>= (let ((edges (window-edges)))
            (- (nth 2 edges) (nth 0 edges)))
          162)
      'split-window-horizontally
    'split-window-vertically))
--8<---------------cut here---------------end--------------->8---

I don't use scroll bars, so if the current window is 162 columns wide a
horizontal split will result in two 80 column wide windows.  Two columns
will be occupied by the additional fringe.

Anyway, I like Juri's suggestion because it gives the user a very good
control over splitting decisions.

Bye,
Tassilo
-- 
A morning without coffee is like something without something else.





reply via email to

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