Subject: Re: bug#63455: 30.0.50; display-buffer-in-direction is always resizing

From: Juri Linkov <[email-masked]>
Date: Fri, 12 May 2023 20:16:20 +0300

> I think you're right.  In my local Emacs I removed both incarnations of
> that code (the other one being in 'display-buffer--maybe-at-bottom')
> long ago.

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.

> I can only shortly sketch how I manage things here: The end
> of 'help--window-setup' has become
>
>         (help-window-setup
>          (setq window (temp-buffer-window-show (current-buffer) nil t)))
>         (help-make-xrefs (current-buffer))
> 	(when (and window temp-buffer-resize-mode)
>           (let (resize-temp-buffer-window-inhibit)
>             (resize-temp-buffer-window window)))))))
>
> 'temp-buffer-window-show' has a third argument NO-RESIZE and its last
> lines are rewritten as
>
> 	(with-selected-window window
> 	  (run-hooks 'temp-buffer-window-show-hook)
> 	  (when (and (not no-resize) temp-buffer-resize-mode)
> 	    (resize-temp-buffer-window window)))
> 	;; Return the window.
> 	window))))
>
> Maybe Juri can make heads or tails of this.

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

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

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