unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
@ 2015-07-21  9:03 Artur Malabarba
  2015-07-21 11:07 ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Artur Malabarba @ 2015-07-21  9:03 UTC (permalink / raw)
  To: 21100

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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21  9:03 bug#21100: 25.0.50; quit-restore-window should also retore width, not just height Artur Malabarba
@ 2015-07-21 11:07 ` martin rudalics
  2015-07-21 12:31   ` Artur Malabarba
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2015-07-21 11:07 UTC (permalink / raw)
  To: bruce.connor.am, 21100

 > 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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 11:07 ` martin rudalics
@ 2015-07-21 12:31   ` Artur Malabarba
  2015-07-21 12:47     ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Artur Malabarba @ 2015-07-21 12:31 UTC (permalink / raw)
  To: martin rudalics; +Cc: 21100

2015-07-21 12:07 GMT+01:00 martin rudalics <rudalics@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).





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 12:31   ` Artur Malabarba
@ 2015-07-21 12:47     ` martin rudalics
  2015-07-21 13:32       ` Artur Malabarba
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2015-07-21 12:47 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: 21100

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 12:47     ` martin rudalics
@ 2015-07-21 13:32       ` Artur Malabarba
  2015-07-21 17:04         ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Artur Malabarba @ 2015-07-21 13:32 UTC (permalink / raw)
  To: martin rudalics; +Cc: 21100

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 13:32       ` Artur Malabarba
@ 2015-07-21 17:04         ` martin rudalics
  2015-07-21 21:33           ` Artur Malabarba
  2015-07-22 10:37           ` martin rudalics
  0 siblings, 2 replies; 11+ messages in thread
From: martin rudalics @ 2015-07-21 17:04 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: 21100

 > 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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 17:04         ` martin rudalics
@ 2015-07-21 21:33           ` Artur Malabarba
  2015-07-21 22:48             ` martin rudalics
  2015-07-22 10:37           ` martin rudalics
  1 sibling, 1 reply; 11+ messages in thread
From: Artur Malabarba @ 2015-07-21 21:33 UTC (permalink / raw)
  To: martin rudalics; +Cc: 21100

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 21:33           ` Artur Malabarba
@ 2015-07-21 22:48             ` martin rudalics
  0 siblings, 0 replies; 11+ messages in thread
From: martin rudalics @ 2015-07-21 22:48 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: 21100

 > 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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-21 17:04         ` martin rudalics
  2015-07-21 21:33           ` Artur Malabarba
@ 2015-07-22 10:37           ` martin rudalics
  2015-07-22 12:33             ` Artur Malabarba
  1 sibling, 1 reply; 11+ messages in thread
From: martin rudalics @ 2015-07-22 10:37 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: 21100

 > 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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-22 10:37           ` martin rudalics
@ 2015-07-22 12:33             ` Artur Malabarba
  2015-08-24  8:16               ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Artur Malabarba @ 2015-07-22 12:33 UTC (permalink / raw)
  To: martin rudalics; +Cc: 21100

2015-07-22 11:37 GMT+01:00 martin rudalics <rudalics@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!





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#21100: 25.0.50; quit-restore-window should also retore width, not just height
  2015-07-22 12:33             ` Artur Malabarba
@ 2015-08-24  8:16               ` martin rudalics
  0 siblings, 0 replies; 11+ messages in thread
From: martin rudalics @ 2015-08-24  8:16 UTC (permalink / raw)
  To: bruce.connor.am; +Cc: 21100-done

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





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-08-24  8:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-21  9:03 bug#21100: 25.0.50; quit-restore-window should also retore width, not just height Artur Malabarba
2015-07-21 11:07 ` martin rudalics
2015-07-21 12:31   ` Artur Malabarba
2015-07-21 12:47     ` martin rudalics
2015-07-21 13:32       ` Artur Malabarba
2015-07-21 17:04         ` martin rudalics
2015-07-21 21:33           ` Artur Malabarba
2015-07-21 22:48             ` martin rudalics
2015-07-22 10:37           ` martin rudalics
2015-07-22 12:33             ` Artur Malabarba
2015-08-24  8:16               ` martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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