Subject: Re: bug#70773: 30.0.50; display-delayed-warnings does not respect display-buffer-alist

From: Juri Linkov <[email-masked]>
Date: Sun, 05 May 2024 09:58:13 +0300

> The display-delayed-warnings does not conform with display-buffer-no-window.

Thanks for the bug report.

> To test this, I create a new directory and write an init.el with the
> following contents:
>
>     (setq display-buffer-alist
>           '(("\\`\\*\\(Warnings\\|Compile-Log\\|Org Links\\)\\*\\'"
>              (display-buffer-no-window)
>              (allow-no-window . t))))

`allow-no-window' is intended to be provided only by the caller,
when the caller can handle the nil value for window.

So here is the patch that implements this in the caller:

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 8c1e43934ff..d0e130abaf8 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -372,15 +372,17 @@ display-warning
 		     (warning-suppress-p type warning-suppress-types)
 		     (let ((window (display-buffer
 				    buffer
-				    (when warning-display-at-bottom
-				      '(display-buffer--maybe-at-bottom
-					(window-height . (lambda (window)
-					  (fit-window-to-buffer window 10)))
-					(category . warning))))))
-		       (when (and (markerp warning-series)
+				    (if warning-display-at-bottom
+				        '(display-buffer--maybe-at-bottom
+					  (window-height . (lambda (window)
+                                            (fit-window-to-buffer window 10)))
+					  (category . warning)
+                                          (allow-no-window . t))
+                                      '(nil (allow-no-window . t))))))
+		       (when (and window (markerp warning-series)
 				  (eq (marker-buffer warning-series) buffer))
 			 (set-window-start window warning-series))
-		       (when warning-display-at-bottom
+		       (when (and warning-display-at-bottom window)
 			 (with-selected-window window
 			   (goto-char (point-max))
 			   (forward-line -1)