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

From: Juri Linkov <[email-masked]>
Date: Fri, 05 Apr 2024 19:47:50 +0300

>>> 'display-comint-buffer-action' and 'display-tex-shell-buffer-action'
>>> are out of place in window.el, and they are redundant per se.
>>>
>>> What these variables are trying to achieve is already possible
>>> to do by using a 'category' in 'display-buffer-alist'.
>>>
>>> Or we need to keep backward-compatibility?  Then the first step
>>> to deprecate there variables would be something like this:
>>
>> Please proceed as carefully as possible, here might be dragons.
>
> Ok, here is a complete patch:

So now pushed.

Here is a new patch that adds the category 'warning' to 'display-warning',
as well as adds the default display action that is like the action in
'debug' that displays the "*Backtrace*" buffer.

One problem is that I can't find an alist item to limit
the window height, i.e. can't find window-max-height
that would be like window-min-height, but to set a max height.
Could you suggest such an alist item?

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 6c62a56e99c..2a9f5e5d9f9 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -358,7 +358,12 @@ display-warning
 		 (or (< (warning-numeric-level level)
 			(warning-numeric-level warning-minimum-level))
 		     (warning-suppress-p type warning-suppress-types)
-		     (let ((window (display-buffer buffer)))
+		     (let ((window (display-buffer
+                                    buffer
+                                    '(display-buffer--maybe-at-bottom
+                                      (window-min-height . 10)
+                                      (window-height . fit-window-to-buffer)
+                                      (category . warning)))))
 		       (when (and (markerp warning-series)
 				  (eq (marker-buffer warning-series) buffer))
 			 (set-window-start window warning-series))