Subject: Re: bug#69983: Use category for display-buffer-alist

From: Juri Linkov <[email-masked]>
Date: Sun, 21 Apr 2024 09:52:50 +0300

>> +		       (when warning-display-at-bottom
>> +                         (with-selected-window window
>> +                           (set-window-point window (point-max))
>> +                           (recenter -1)))
>
> Should we perhaps do the same as end-of-buffer does, i.e.
>
> 	 (recenter (if (and scroll-minibuffer-conservatively
> 	                    (window-minibuffer-p))
> 	               -1 -3)))))

I tried many different things before reaching the 'recenter' solution.
For example, tried everything from the Info node
(info "(emacs) Auto Scrolling") such as scroll-conservatively,
scroll-step, scroll-up-aggressively/scroll-down-aggressively
to avoid recentering after scrolling.  But none of them work,
so an extra step is required to use 'recenter' after moving point.

Also too bad that need to use 'with-selected-window' instead of
'with-current-buffer', since 'recenter' has no 'window' argument.

> (or, if the window here can never be a mini-window, just use -3
> instead of -1 in the call to recenter)?

I don't understand why 'end-of-buffer' leaves 2 additional empty lines
at bottom.  Every time when I use 'M->' (end-of-buffer), I need
to type additional keys to manually scroll more 2 lines down
to remove these 2 empty lines from the screen.

Maybe 'end-of-buffer' should use -1 when 'scroll-conservatively' is set
as this FIXME comment in 'end-of-buffer' suggests:

	 ;; FIXME: Arguably if `scroll-conservatively' is set, then
         ;; we should pass -1 to `recenter'.
	 (recenter (if (and scroll-minibuffer-conservatively
	                    (window-minibuffer-p))
	               -1 -3))

Anyway, the warning buffer is as narrow as the minibuffer,
so -1 is the right value for 'display-warning'.