(when window-system
;; Prefer horizontal windows splitting.
(setq split-height-threshold 0)
(setq split-width-threshold nil)
)
But how stop Emacs from splitting when already 2 windows?
So reuse existing window.
For example I edit file (1 window) then M-x compile (2 windows)
then C-x ` (2 windows, *Compilation* and source with error) -
no other window appear.
Emacs 23.1/22.3/21.4 work in such way on Debian, but new Emacs 23.2.1
work different.
For example: open file, C-x v l (new window show log),
d (new window show diff, there are 3 windows now),
M-x man printf RET (new window show man, there 4 windows now).
So how force Emacs display no more that 2 windows at same time?
This is not exactly what you were asking for. I wanted to get emacs to
do what it was doing before. I followed the instructions but found
that it kept creating smaller and smaller windows. So, now I leave
split-height-threshold alone and do this (this is inside my
.emacs.d/init.el file.
(custom-set-variables
...
'(split-width-threshold 1600)
)
which basically says "don't split windows vertically".
Setting it to nil didn't have the effect I was looking for.
pedz
> > This is not exactly what you were asking for. I wanted to get emacs to
> > do what it was doing before. I followed the instructions but found
>
> Which instructions?
The documentation for split-width-threshold, split-height-threshold, and
split-window-sensibly. In particular, split-window sensibly says:
You can enforce this function to not split WINDOW horizontally,
by setting (or binding) the variable `split-width-threshold' to
nil. If, in addition, you set `split-height-threshold' to zero,
chances increase that this function does split WINDOW vertically.
The last sentence prompted me to set split-height-threshold to 0
and that is probably why I constantly got smaller and smaller windows
instead of reusing a previous window.
>
> > that it kept creating smaller and smaller windows. So, now I leave
> > split-height-threshold alone and do this (this is inside my
> > .emacs.d/init.el file.
> >
> > (custom-set-variables
> > ...
> > '(split-width-threshold 1600)
> > )
> >
> > which basically says "don't split windows vertically".
>
> Actually it means "don't split windows horizontally" ;-)
Yea. I totally don't understand the language here. A vertically line
creating two windows is splitting it vertically in my pee sized brain.
Sorry about that.
>
> > Setting it to nil didn't have the effect I was looking for.
>
> What effect were you looking for?
What emacs use to do before split-window-sensibly.
> To avoid that `display-buffer' creates smaller and smaller windows, set
> the values of either or both `split-height-threshold' and
> `split-width-threshold' to nil or to some larger value. If this doesn't
> work for you there's a bug; so please try to tell us more precisely what
> you wanted to do and how it failed.
At the time, I concluded that it wasn't a bug in the code but just
that I misread / misunderstood the documentation. I believe I tried
setting split-width-threshold to nil and split-height-threshold (after
trying 0), I tried leaving it alone and it still didn't go back to the
old method. Setting split-width-threshold to some giant number
seems to take a different path through the code and gives me
the old behavior.
I can experiment more if you want me to and try and recreate
what I was setting.
pedz
> You can enforce this function to not split WINDOW horizontally,
> by setting (or binding) the variable `split-width-threshold' to
> nil. If, in addition, you set `split-height-threshold' to zero,
> chances increase that this function does split WINDOW vertically.
>
> The last sentence prompted me to set split-height-threshold to 0
> and that is probably why I constantly got smaller and smaller windows
> instead of reusing a previous window.
Replacing "zero" by "a smaller value" might cause less confusion here.
>> Actually it means "don't split windows horizontally" ;-)
>
> Yea. I totally don't understand the language here. A vertically line
> creating two windows is splitting it vertically in my pee sized brain.
> Sorry about that.
I'm afraid every second user interprets this as you did. Unfortunately,
it's not easy to find a less confusing term here. We could replace
"horizontally" by "side-by-side" but I have no idea which term to use
instead of "vertically".
>> What effect were you looking for?
>
> What emacs use to do before split-window-sensibly.
Do you use wide frames so Emacs tries to split them into side-by-side
windows? What are your frame sizes?
> At the time, I concluded that it wasn't a bug in the code but just
> that I misread / misunderstood the documentation. I believe I tried
> setting split-width-threshold to nil and split-height-threshold (after
> trying 0), I tried leaving it alone and it still didn't go back to the
> old method. Setting split-width-threshold to some giant number
> seems to take a different path through the code and gives me
> the old behavior.
If you never want more than two windows per frame the following should
be sufficient:
(setq split-height-threshold nil)
(setq split-width-threshold nil)
> I followed the instructions but found
> that it kept creating smaller and smaller windows.
Same things!
> So, now I leave split-height-threshold alone and do this:
>
> (setq split-width-threshold 1600)
>
> which basically says "don't split windows vertically".
Nice!
> Setting it to nil didn't have the effect I was looking for.
>
Sad.
--
Best regards!
Next week test on BAD notebook
with Debian/Emacs 23.2.1/1280x800.
--
Best regards!
This prefers "vertical" splitting in Emacs parlance ;-) But why do you
check for `window-system' and why do you set `split-height-threshold' to
zero?
> But how stop Emacs from splitting when already 2 windows?
> So reuse existing window.
Whenever you ask Emacs to display a buffer, it looks at the largest
window on your frame which, since you don't make side-by-side windows,
is the highest window on your frame. In `window-splittable-p' the
following happens:
(>= (window-height window)
(max split-height-threshold
(* 2 (max window-min-height
(if mode-line-format 2 1))))))))))
Since `split-height-threshold' is zero, a new window is split off
whenever the height of the largest window (the value of `window-height'
for that window) is at least as large as two times the minimum height of
the largest window (the value of `window-min-height').
Try setting `split-height-threshold' and `split-width-threshold' both to
nil. This should allow at most two windows on your frames.
martin
Which instructions?
> that it kept creating smaller and smaller windows. So, now I leave
> split-height-threshold alone and do this (this is inside my
> .emacs.d/init.el file.
>
> (custom-set-variables
> ...
> '(split-width-threshold 1600)
> )
>
> which basically says "don't split windows vertically".
Actually it means "don't split windows horizontally" ;-)
> Setting it to nil didn't have the effect I was looking for.
What effect were you looking for?
To avoid that `display-buffer' creates smaller and smaller windows, set
the values of either or both `split-height-threshold' and
`split-width-threshold' to nil or to some larger value. If this doesn't
work for you there's a bug; so please try to tell us more precisely what
you wanted to do and how it failed.
Thanks, martin
Replacing "zero" by "a smaller value" might cause less confusion here.
>> Actually it means "don't split windows horizontally" ;-)
>
> Yea. I totally don't understand the language here. A vertically line
> creating two windows is splitting it vertically in my pee sized brain.
> Sorry about that.
I'm afraid every second user interprets this as you did. Unfortunately,
it's not easy to find a less confusing term here. We could replace
"horizontally" by "side-by-side" but I have no idea which term to use
instead of "vertically".
>> What effect were you looking for?
>
> What emacs use to do before split-window-sensibly.
Do you use wide frames so Emacs tries to split them into side-by-side
windows? What are your frame sizes?
> At the time, I concluded that it wasn't a bug in the code but just
> that I misread / misunderstood the documentation. I believe I tried
> setting split-width-threshold to nil and split-height-threshold (after
> trying 0), I tried leaving it alone and it still didn't go back to the
> old method. Setting split-width-threshold to some giant number
> seems to take a different path through the code and gives me
> the old behavior.
If you never want more than two windows per frame the following should
be sufficient:
(setq split-height-threshold nil)
(setq split-width-threshold nil)
martin
I think we could use `split-window-side-by-side' instead of
`split-window-horizontally'. But using `split-window-top-and-bottom'
instead of `split-window-vertically' doesn't sound very intuitive.
> Yea. My code is generally 80 columns but I have to widen my frame
> extra wide to fit Ruby's error messages into one line. At that point, emacs
> started splitting my screen side-by-side which defected the
> whole purpose of a wide frame.
I see. Is line wrapping for Ruby error messages bad? Where do you show
them - in a separate window?
martin