GNU bug report logs - #21100
25.0.50; quit-restore-window should also retore width, not just height

Previous Next

Package: emacs;

Reported by: bruce.connor.am <at> gmail.com

Date: Tue, 21 Jul 2015 09:04:02 UTC

Severity: normal

Found in version 25.0.50

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21100 in the body.
You can then email your comments to 21100 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 09:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to bruce.connor.am <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 21 Jul 2015 09:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; quit-restore-window should also retore width, not just height
Date: Tue, 21 Jul 2015 10:03:19 +0100
1. Split the frame into two windows, one above the other.
2. Make the bottom window very small.
3. With point in the larger window, run `C-h f point RET'
4. The bottom window increases in size to display the Help buffer.
5. Hit q in the help buffer.
6. The height of the bottom window is retored.

This does not happen if you split the frame into side-by-side windows,
and make of them very narrow. In this case, the width of the window
increases to display the help buffer, but it is not restored on quit.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 11:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bruce.connor.am <at> gmail.com, 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Tue, 21 Jul 2015 13:07:19 +0200
> 1. Split the frame into two windows, one above the other.
> 2. Make the bottom window very small.
> 3. With point in the larger window, run `C-h f point RET'
> 4. The bottom window increases in size to display the Help buffer.

I can't reproduce that here.  Even with `temp-buffer-resize-mode'
enabled, the window doen't change its size because reused windows are
not resized.  From the doc-string of `temp-buffer-resize-mode':

  When Temp Buffer Resize mode is enabled, the windows in which we
  show a temporary buffer are automatically resized in height to
  fit the buffer's contents, but never more than
  `temp-buffer-max-height' nor less than `window-min-height'.

  A window is resized only if it has been specially created for the
  buffer.  Windows that have shown another buffer before are not
  resized.  A frame is resized only if `fit-frame-to-buffer' is
  non-nil.

So what did you do to accomplish that resize?

> 5. Hit q in the help buffer.
> 6. The height of the bottom window is retored.

Here the size remains unchanged again.

> This does not happen if you split the frame into side-by-side windows,
> and make of them very narrow. In this case, the width of the window
> increases to display the help buffer,

For such behavior your `fit-window-to-buffer-horizontally' must be
non-nil, I presume.

> but it is not restored on quit.

It's true that `quit-restore-window' can't restore a previous width and
it should be fairly easy to fix that.  But can you provide me a simple
scenario starting with emacs -Q so I can test it?  I apparently forgot
how this is supposed to work.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 12:32:02 GMT) Full text and rfc822 format available.

Message #11 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Tue, 21 Jul 2015 13:31:32 +0100
2015-07-21 12:07 GMT+01:00 martin rudalics <rudalics <at> gmx.at>:
>> 1. Split the frame into two windows, one above the other.
>> 2. Make the bottom window very small.
>> 3. With point in the larger window, run `C-h f point RET'
>> 4. The bottom window increases in size to display the Help buffer.
>
> I can't reproduce that here.

That's probably because your monitor is larger than my laptop's.

> So what did you do to accomplish that resize?

Try doing (set-face-attribute 'default nil :height 290)

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.

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).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 12:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bruce.connor.am <at> gmail.com
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Tue, 21 Jul 2015 14:47:13 +0200
>>> 1. Split the frame into two windows, one above the other.
>>> 2. Make the bottom window very small.
>>> 3. With point in the larger window, run `C-h f point RET'
>>> 4. The bottom window increases in size to display the Help buffer.
>>
>> I can't reproduce that here.
>
> That's probably because your monitor is larger than my laptop's.
>
>> 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.

> 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.

> 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?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 13:34:05 GMT) Full text and rfc822 format available.

Message #17 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 17:05:01 GMT) Full text and rfc822 format available.

Message #20 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bruce.connor.am <at> gmail.com
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Tue, 21 Jul 2015 19:04:08 +0200
> This was from emacs -Q. On my machine (running Ubuntu), with a
> maximized frame,

emacs -Q doesn't start in 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).

Not if it's maximized.  I spent some time on the code handling that.

> 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).

I have no problem resizing my frame so it makes either a new window on
the bottom or on the right.  The problem is that you are talking about
_reusing_ a window on the bottom or 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.

Now I understand.  This resizing is due to `even-window-heights' being
non-nil by default.  If you set that to nil, no resizing is done.  Also,
with more than two windows, you get no resizing either.  This is a very
old option, introduced some time before automatic side-by-side splitting
was introduced.

> 4. If you hit q on that help window, it will return to the original
> height of 5 lines.

Funny.  I never even tested that.

>> 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.

The re-resizing should occur in `quit-restore-window' on this line:

	    (window-resize window (- (nth 3 quad) (window-total-height window)))

Please check.

So what you probably want is a new option `even-window-widths' (or maybe
`even-window-sizes') which, if non-nil, does for side-by-side splits the
same thing `even-window-heights' does for a below split.  And,
obviously, `quit-restore-window' should be able to size it back (I have
written this part already).  Suggestions welcome.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 21:34:01 GMT) Full text and rfc822 format available.

Message #23 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Tue, 21 Jul 2015 22:33:38 +0100
> The re-resizing should occur in `quit-restore-window' on this line:
>
>             (window-resize window (- (nth 3 quad) (window-total-height
> window)))
>
> Please check.

Yes, it does.

> So what you probably want is a new option `even-window-widths' (or maybe
> `even-window-sizes') which, if non-nil, does for side-by-side splits the
> same thing `even-window-heights' does for a below split.

I have nothing against a new option, but that's not what I'm asking
for. I'm fine with the current behavior (which is to even the width).

> And, obviously, `quit-restore-window' should be able to size it back

Yes, this is what I would like.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Tue, 21 Jul 2015 22:49:02 GMT) Full text and rfc822 format available.

Message #26 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bruce.connor.am <at> gmail.com
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Wed, 22 Jul 2015 00:48:41 +0200
> I have nothing against a new option, but that's not what I'm asking
> for. I'm fine with the current behavior (which is to even the width).

You're fine with a fata morgana ;-)

But if you insist: Please tell me which function does even the widths.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Wed, 22 Jul 2015 10:39:02 GMT) Full text and rfc822 format available.

Message #29 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bruce.connor.am <at> gmail.com
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Wed, 22 Jul 2015 12:37:51 +0200
> So what you probably want is a new option `even-window-widths' (or maybe
> `even-window-sizes') which, if non-nil, does for side-by-side splits the
> same thing `even-window-heights' does for a below split.  And,
> obviously, `quit-restore-window' should be able to size it back (I have
> written this part already).

I renamed `even-window-heights' to `even-window-sizes'.  The behavior
should be now as you requested.  Please have a look.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21100; Package emacs. (Wed, 22 Jul 2015 12:35:01 GMT) Full text and rfc822 format available.

Message #32 received at 21100 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 21100 <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Wed, 22 Jul 2015 13:33:56 +0100
2015-07-22 11:37 GMT+01:00 martin rudalics <rudalics <at> gmx.at>:
>> So what you probably want is a new option `even-window-widths' (or maybe
>> `even-window-sizes') which, if non-nil, does for side-by-side splits the
>> same thing `even-window-heights' does for a below split.  And,
>> obviously, `quit-restore-window' should be able to size it back (I have
>> written this part already).
>
> I renamed `even-window-heights' to `even-window-sizes'.  The behavior
> should be now as you requested.  Please have a look.

Looks perfect! Thank you, Martin!




Reply sent to martin rudalics <rudalics <at> gmx.at>:
You have taken responsibility. (Mon, 24 Aug 2015 08:18:02 GMT) Full text and rfc822 format available.

Notification sent to bruce.connor.am <at> gmail.com:
bug acknowledged by developer. (Mon, 24 Aug 2015 08:18:03 GMT) Full text and rfc822 format available.

Message #37 received at 21100-done <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: bruce.connor.am <at> gmail.com
Cc: 21100-done <at> debbugs.gnu.org
Subject: Re: bug#21100: 25.0.50; quit-restore-window should also retore width,
 not just height
Date: Mon, 24 Aug 2015 10:16:59 +0200
>> I renamed `even-window-heights' to `even-window-sizes'.  The behavior
>> should be now as you requested.  Please have a look.
>
> Looks perfect! Thank you, Martin!

Closing this bug.  If there are still issues, feel free to reopen it.

Thanks for the report and the additional information, martin




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 21 Sep 2015 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.