GNU bug report logs - #69983
Use category for display-buffer-alist

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 24 Mar 2024 17:22:01 UTC

Severity: normal

Fixed in version 30.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rudalics <at> gmx.at, 69983 <at> debbugs.gnu.org
Subject: bug#69983: Use category for display-buffer-alist
Date: Fri, 19 Apr 2024 19:17:14 +0300
[Message part 1 (text/plain, inline)]
> Sorry, actually you are right, let's add a new option.
> Will do this soon.

The reason why a new option is needed is because display-warning
doesn't move point to the bottom line with the last message.

So when the warning buffer will be displayed at the bottom of
the screen in a narrow window, but the window always stays
displaying the top of the warning buffer, the users will miss
the last unseen message.

To solve this problem, a new option 'warning-display-at-bottom'
(whose name has the same prefix as all other options in the same file)
will scroll the bottom window, so the last message will always
be visible to the user.

[warning-display-at-bottom.patch (text/x-diff, inline)]
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 8b43c6a8726..672c9ed4618 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -120,6 +120,14 @@ warning-suppress-types
 See also `warning-suppress-log-types'."
   :type '(repeat (repeat symbol))
   :version "22.1")
+
+(defcustom warning-display-at-bottom t
+  "Display the warning buffer at the bottom of the screen.
+The output window will be scrolled to the bottom of the buffer
+to show the last warning message."
+  :type 'boolean
+  :version "30.1")
+
 
 ;; The autoload cookie is so that programs can bind this variable
 ;; safely, testing the existing value, before they call one of the
@@ -362,10 +370,20 @@ 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
+				    (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)
 				  (eq (marker-buffer warning-series) buffer))
 			 (set-window-start window warning-series))
+		       (when warning-display-at-bottom
+                         (with-selected-window window
+                           (set-window-point window (point-max))
+                           (recenter -1)))
 		       (sit-for 0)))))))))
 
 ;; Use \\<special-mode-map> so that help-enable-autoload can do its thing.

This bug report was last modified 1 year and 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.