Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width, not just height

From: Artur Malabarba <[email-masked]>
Date: Tue, 21 Jul 2015 14:32:54 +0100

>>> So what did you do to accomplish that resize?
>>
>> Try doing (set-face-attribute 'default nil :height 290)
>
> That's no recipe, at least not with emacs -Q.  With emacs -Q this just
> makes my frame much larger than my display.  Please try to give me a
> recipe with emacs -Q.  Something's at work here which I don't understand
> yet.

This was from emacs -Q. On my machine (running Ubuntu), with a
maximized frame, increasing the font-size doesn't make the frame
larger. Maybe it's a difference in the OS (I think on Windows if you
increase font-size the frame does get enlarged).

The point is that the combination of font-size and frame-size has to
be such that two windows do not fit side-by-side. In this situation,
Emacs usually creates temp windows below the current window (instead
of to the right). Here's a new recipe to verify what I'm explaining
now.

0. Start emacs -Q
1. Resize the frame so that it is less than 30 columns wide, and at
least 30 lines tall.
2. Type `C-h f point RET'.
3. The temp window is created below.

Now here is an updated recipe for the original behavior I was
describing (the fact that windows are vertically expanded to fit the
help buffer).

0. Start emacs -Q
1. Resize the frame so that it is less than 30 columns wide, and at
least 30 lines tall.
2. Type `C-- C-5 C-x C-2', to create a tiny window below.
2. Type `C-h f point RET'.
3. The temp buffer is displayed in the window you had created, and the
windows size is increased to half the frame.
4. If you hit q on that help window, it will return to the original
height of 5 lines.

>> If the frame is large enough to fit two windows side-by-side, then the
>> help buffer will always be created in a new window to the right.
>
> This contradicts your scenario where you say that the help buffer reuses
> an already existing window.

This sentence was part of the explanation leading up to the next one.
The next sentence is the one that describes the behavior I get. Sorry
if I wasn't clear.

>> However, if the font size is large enough that two windows do NOT fit
>> side by side in the frame, then the window is created below. In this
>> scenario, you get the behavior I described (i.e., if there's already a
>> window below the current one, it is reused by the help buffer and it
>> is expanded if necessary).
>
> It's just that I don't know _why_ a reused window would be expanded.
> Can you point me to where in the code this expansion takes place?

Some edebugging shows me it is done by
`display-buffer-use-some-window', and indeed I see a `window-resize'
in there.