From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
63455@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#63455: 30.0.50; display-buffer-in-direction is always resizing
Date: Sat, 13 May 2023 10:56:16 +0200 [thread overview]
Message-ID: <8f609c16-2302-2dca-0c5a-b740da6e1686@gmx.at> (raw)
In-Reply-To: <86zg69lb6v.fsf@mail.linkov.net>
> There are 3 uses of 'display-buffer--maybe-at-bottom' in the Emacs
> source tree: 'project-kill-buffers' and 'save-buffers-kill-emacs'
> override the default. But 'hack-local-variables-confirm'
> depends on the current default value.
In 'hack-local-variables-confirm' I'm using
(pop-to-buffer
buf '(display-buffer--maybe-at-bottom
(window-height . (fit-window-to-buffer))))
> Are these changes intended to completely remove these lines from
> 'display-buffer-in-direction' and 'display-buffer--maybe-at-bottom'?
>
> `(,(if temp-buffer-resize-mode
> '(window-height . resize-temp-buffer-window)
> '(window-height . fit-window-to-buffer))
> ,(when temp-buffer-resize-mode
> '(preserve-size . (nil . t))))
Yes.
> I expected that only 1 line should be removed to change this to:
>
> `(,(when temp-buffer-resize-mode
> '(window-height . resize-temp-buffer-window))
> ,(when temp-buffer-resize-mode
> '(preserve-size . (nil . t))))
That wouldn't help. Try with
(defun display-buffer--maybe-at-bottom (buffer alist)
(let ((alist (append alist `(,(when temp-buffer-resize-mode
'(window-height . resize-temp-buffer-window))
,(when temp-buffer-resize-mode
'(preserve-size . (nil . t)))))))
(or (display-buffer--maybe-same-window buffer alist)
(display-buffer-reuse-window buffer alist)
(display-buffer--maybe-pop-up-frame buffer alist)
(display-buffer-at-bottom buffer alist))))
(setq temp-buffer-resize-mode t)
(pop-to-buffer (get-buffer-create "*foo*")
'(display-buffer--maybe-at-bottom))
'temp-buffer-resize-mode' is a global variable. Once a user customized
it to t, _any_ buffer that passes through one of these functions will be
resized, regardless of whether it is a temporary buffer or an "ordinary"
one.
> But if all lines should be removed, then how to use it?
> I tried with your patch, but this doesn't resize the window:
>
> (setq temp-buffer-resize-mode t)
> (display-buffer (current-buffer)
> '((display-buffer-in-direction) . ((direction . top))))
Right. You can use, for example,
(setq temp-buffer-resize-mode t)
(temp-buffer-window-show (current-buffer)
'((display-buffer-in-direction) . ((direction . top))))
which obviously makes the current buffer temporary with all its
consequences. But 'temp-buffer-resize-mode' _is_ about temporary
buffers.
Note that when 'temp-buffer-resize-mode' is set, the way Emacs handles
this currently is wrong for _two_ reasons:
- When 'display-buffer' calls one of these functions it will resize the
window regardless of whether it should be resized or not - that's the
subject of the present bug.
- When the user customizes 'display-buffer-alist' to call another
display action, say 'display-buffer-below-selected', the window will
not be resized. Try without and with the first form evaluated:
(setq display-buffer-alist
'(("*foo*" display-buffer-below-selected)))
(pop-to-buffer (get-buffer-create "*foo*")
'(display-buffer--maybe-at-bottom))
We could add a buffer-local variable say 'temporary' which the temporary
buffer functions would set and 'display-buffer' would always obey in
conjunction with 'temp-buffer-resize-mode'. Then a program or the user
could set or reset that variable to obtain the desired behavior with
plain 'display-buffer' calls as well. Whether such an option is clean
is another question.
martin
next prev parent reply other threads:[~2023-05-13 8:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 1:06 bug#63455: 30.0.50; display-buffer-in-direction is always resizing Michael Heerdegen
2023-05-12 7:39 ` martin rudalics
2023-05-12 17:16 ` Juri Linkov
2023-05-13 8:56 ` martin rudalics [this message]
2023-05-15 17:01 ` Juri Linkov
2023-05-15 18:21 ` Eli Zaretskii
2023-05-16 7:19 ` martin rudalics
2023-05-16 16:35 ` Juri Linkov
2023-05-17 16:56 ` Juri Linkov
2023-05-18 8:29 ` martin rudalics
2023-05-18 15:54 ` Juri Linkov
2023-05-19 7:31 ` martin rudalics
2023-05-19 17:54 ` Juri Linkov
2023-05-20 8:27 ` martin rudalics
2023-05-22 18:03 ` Juri Linkov
2023-05-23 2:30 ` Michael Heerdegen
2023-05-23 18:25 ` Juri Linkov
2023-05-24 2:48 ` Michael Heerdegen
2023-05-12 17:11 ` Juri Linkov
2023-05-13 5:29 ` Michael Heerdegen
2023-05-15 17:02 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f609c16-2302-2dca-0c5a-b740da6e1686@gmx.at \
--to=rudalics@gmx.at \
--cc=63455@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=juri@linkov.net \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).