bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51062: Customizable window resizing


From: Juri Linkov
Subject: bug#51062: Customizable window resizing
Date: Wed, 13 Oct 2021 21:46:58 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> There are two ways how window resizing is currently hard-coded:
>>
>> 1. As discussed in
>>     https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01627.html
>>     when temp-buffer-resize-mode is enabled, it's impossible
>>     to disable automatic window resizing of the Help buffer.
>>
>>     Thanks to Martin, the patch in
>>     https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01873.html
>>     allows customization when display-buffer-alist contains
>>     (window-height . nil)
>
> That patch should help wherever 'temp-buffer-resize-mode' applies, not
> just in a Help buffer.
>
> This patch has been meanwhile applied on master.

Strange, when I tested the patch that you sent to emacs-devel,
it worked correctly.  But after you applied the patch on master,
it doesn't work.  I'm trying to debug why (window-height . nil)
has no effect on Help buffers.

>> 2. As discussed in bug#45688, such commands as vc-log
>
> Which command is 'vc-log'?

I meant log-related vc-commands that use
shrink-window-if-larger-than-buffer, i.e.
all commands that use vc-log-internal-common.

>>     , vc-diff
>>     automatically resize the window, and the problem is that currently
>>     shrink-window-if-larger-than-buffer is used in these commands by default,
>>     but this behavior is hard-coded and can't be disabled by customization.
>>     A solution is to create a new hook like 'after-display-buffer-function'
>>     that by default will contain 'shrink-window-if-larger-than-buffer'.
>
> Wherever we currently use an idiom like
>
> (pop-to-buffer (current-buffer))
> (goto-char (point-min))
> (shrink-window-if-larger-than-buffer)
>
> we should use
>
> (pop-to-buffer
>  (current-buffer)
>  '(nil (window-height . shrink-window-if-larger-than-buffer)))
> (goto-char (point-min))
>
> instead.  But if 'display-buffer' is not involved, there isn't much we
> can do.  Maybe something like 'display-buffer-same-window' _after_
> putting the buffer into the selected window, but this might not be 100%
> compatible.  Certainly not for Emacs 28.

This is a good idea to try.  But not sure how this is possible to use in
vc-run-delayed that is called when the buffer was already displayed long ago.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]