* Windows splitting: prefer only 2 windows horizontal spliting.
@ 2011-02-20 20:52 Oleksandr Gavenko (aka gavenkoa)
2011-02-20 23:07 ` Perry Smith
0 siblings, 1 reply; 11+ messages in thread
From: Oleksandr Gavenko (aka gavenkoa) @ 2011-02-20 20:52 UTC (permalink / raw)
To: help-gnu-emacs
How prefer horizontal splitting I know:
(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?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-20 20:52 Oleksandr Gavenko (aka gavenkoa)
@ 2011-02-20 23:07 ` Perry Smith
2011-02-21 22:40 ` Oleksandr Gavenko
0 siblings, 1 reply; 11+ messages in thread
From: Perry Smith @ 2011-02-20 23:07 UTC (permalink / raw)
To: Oleksandr Gavenko (aka gavenkoa); +Cc: help-gnu-emacs
On Feb 20, 2011, at 2:52 PM, Oleksandr Gavenko (aka gavenkoa) wrote:
> How prefer horizontal splitting I know:
>
> (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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
@ 2011-02-21 7:46 martin rudalics
0 siblings, 0 replies; 11+ messages in thread
From: martin rudalics @ 2011-02-21 7:46 UTC (permalink / raw)
To: gavenkoa; +Cc: help-gnu-emacs
> How prefer horizontal splitting I know:
>
>
> (when window-system
> ;; Prefer horizontal windows splitting.
> (setq split-height-threshold 0)
> (setq split-width-threshold nil)
> )
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
@ 2011-02-21 7:47 martin rudalics
2011-02-21 14:15 ` Perry Smith
0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2011-02-21 7:47 UTC (permalink / raw)
To: pedzsan, help-gnu-emacs
> 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?
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-21 7:47 martin rudalics
@ 2011-02-21 14:15 ` Perry Smith
2011-02-21 17:00 ` martin rudalics
0 siblings, 1 reply; 11+ messages in thread
From: Perry Smith @ 2011-02-21 14:15 UTC (permalink / raw)
To: martin rudalics; +Cc: help-gnu-emacs
On Feb 21, 2011, at 1:47 AM, martin rudalics wrote:
> > 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-21 14:15 ` Perry Smith
@ 2011-02-21 17:00 ` martin rudalics
2011-02-21 17:43 ` Perry Smith
0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2011-02-21 17:00 UTC (permalink / raw)
To: Perry Smith; +Cc: help-gnu-emacs
> 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)
martin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-21 17:00 ` martin rudalics
@ 2011-02-21 17:43 ` Perry Smith
2011-02-21 19:03 ` martin rudalics
2011-02-21 22:44 ` Oleksandr Gavenko
0 siblings, 2 replies; 11+ messages in thread
From: Perry Smith @ 2011-02-21 17:43 UTC (permalink / raw)
To: martin rudalics; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 2221 bytes --]
On Feb 21, 2011, at 11:00 AM, martin rudalics wrote:
> > 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".
How about "top and bottom" ?
>
> >> 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?
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.
>
> > 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)
Ok. I'll try that.
Thanks,
pedz
[-- Attachment #2: Type: text/html, Size: 2940 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-21 17:43 ` Perry Smith
@ 2011-02-21 19:03 ` martin rudalics
2011-02-21 22:44 ` Oleksandr Gavenko
1 sibling, 0 replies; 11+ messages in thread
From: martin rudalics @ 2011-02-21 19:03 UTC (permalink / raw)
To: Perry Smith; +Cc: help-gnu-emacs
> How about "top and bottom" ?
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-20 23:07 ` Perry Smith
@ 2011-02-21 22:40 ` Oleksandr Gavenko
0 siblings, 0 replies; 11+ messages in thread
From: Oleksandr Gavenko @ 2011-02-21 22:40 UTC (permalink / raw)
To: help-gnu-emacs
On 2011-02-20 23:07, Perry Smith wrote:
> On Feb 20, 2011, at 2:52 PM, Oleksandr Gavenko (aka gavenkoa) wrote:
>> So how force Emacs display no more that 2 windows at same time?
>
> I wanted to get emacs to do what it was doing before.
I also.
> 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!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-21 17:43 ` Perry Smith
2011-02-21 19:03 ` martin rudalics
@ 2011-02-21 22:44 ` Oleksandr Gavenko
2011-03-10 12:38 ` Oleksandr Gavenko
1 sibling, 1 reply; 11+ messages in thread
From: Oleksandr Gavenko @ 2011-02-21 22:44 UTC (permalink / raw)
To: help-gnu-emacs
On 2011-02-21 17:43, Perry Smith wrote:
>>
>> (setq split-height-threshold nil)
>> (setq split-width-threshold nil)
>
> Ok. I'll try that.
>
On 4:5 (1280x1024) screen work fine.
Next week test on BAD notebook
with Debian/Emacs 23.2.1/1280x800.
--
Best regards!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Windows splitting: prefer only 2 windows horizontal spliting.
2011-02-21 22:44 ` Oleksandr Gavenko
@ 2011-03-10 12:38 ` Oleksandr Gavenko
0 siblings, 0 replies; 11+ messages in thread
From: Oleksandr Gavenko @ 2011-03-10 12:38 UTC (permalink / raw)
To: help-gnu-emacs
On 22.02.2011 0:44, Oleksandr Gavenko wrote:
> On 2011-02-21 17:43, Perry Smith wrote:
>>>
>>> (setq split-height-threshold nil)
>>> (setq split-width-threshold nil)
>>
>> Ok. I'll try that.
>>
> On 4:5 (1280x1024) screen work fine.
>
> Next week test on BAD notebook
> with Debian/Emacs 23.2.1/1280x800.
>
This work well on Emacs 22.3, 23.2.1, both Linux/Windows/Cygwin and
GUI/console.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-03-10 12:38 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-21 7:46 Windows splitting: prefer only 2 windows horizontal spliting martin rudalics
-- strict thread matches above, loose matches on Subject: below --
2011-02-21 7:47 martin rudalics
2011-02-21 14:15 ` Perry Smith
2011-02-21 17:00 ` martin rudalics
2011-02-21 17:43 ` Perry Smith
2011-02-21 19:03 ` martin rudalics
2011-02-21 22:44 ` Oleksandr Gavenko
2011-03-10 12:38 ` Oleksandr Gavenko
2011-02-20 20:52 Oleksandr Gavenko (aka gavenkoa)
2011-02-20 23:07 ` Perry Smith
2011-02-21 22:40 ` Oleksandr Gavenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).