bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#3142: 23.0.92; split-window-prefered-function should be able to use


From: Jared Finder
Subject: bug#3142: 23.0.92; split-window-prefered-function should be able to use split-window-horizontally/split-window-vertically
Date: Tue, 28 Apr 2009 10:21:51 -0700

That's not obvious!  I like the idea of the split window thresholds, but it 
needs to be a lot more obvious how to use them.  What's wrong with my 
suggestion to change the customize interface to have two more options "Always 
split vertical" and "Always split horizontal" that calls the appropriate 
functions?

  -- MJF

-----Original Message-----
From: martin rudalics [mailto:address@hidden 
Sent: Monday, April 27, 2009 11:30 PM
To: Jared Finder
Cc: address@hidden
Subject: Re: bug#3142: 23.0.92; split-window-prefered-function should be able 
to use split-window-horizontally/split-window-vertically

 > I would expect that split-window-preferred-function would accept
 > split-window-horizontally and split-window-vertically.

`split-window-preferred-function', if non-nil, must be a function called
with a WINDOW as single argument.  `split-window-vertically' and
`split-window-horizontally' are functions that split the selected window
and take a SIZE argument.  Hence, when you set
`split-window-preferred-function' to `split-window-vertically' as you
did you will get a

split-window-vertically: Window height 1 too small (after splitting)

error because you call `split-window-vertically' with a window as
argument, and `prefix-numeric-value' when called with a window as
argument returns 1, a SIZE argument disliked by `split-window'.
Sounds contrived, but I don't have a better explanation.

If you really need `split-window-preferred-function' use
`split-window-vertically' you have to write a wrapper like

(defun my-split-window-function (window)
   (with-selected-window window
     (split-window-vertically)))

 > At the very
 > least, there should be an easy way to set this to "always split
 > vertically", "always split horizontally", and "intelligently split".

Setting `split-width-threshold' nil for "always split vertically" and
`split-height-threshold' nil for "always split horizontally" should
accomplish that.  Can't you use these directly?

martin







reply via email to

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