Subject: 31.0.50; [PATCH] Stop using the "stop" sign for all warning levels
From: Protesilaos Stavrou <[email-masked]>
To: [email-masked]
Date: Sat, 19 Apr 2025 08:14:00 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Dear maintainers,

The *Warnings* buffer uses the same "stop" sign for "warning" and
"error" level warnings. This makes it hard to quickly scan the buffer
for actual errors.

I attach a patch that uses a different icon for "warning" than for
"error" or "emergency".

All the best,
Protesilaos (or simply "Prot")

From 5544f882c01ba7caa966e16f3074a9a2017e3802 Mon Sep 17 00:00:00 2001
Message-Id: <[email-masked]>
From: Protesilaos Stavrou <[email-masked]>
Date: Sat, 19 Apr 2025 08:06:30 +0300
Subject: [PATCH] Stop using the stop sign for all warning levels

* lisp/emacs-lisp/warnings.el (warnings-suppress): Define distinct icons
for "stop" and "warn".
(warnings-get-icon): Define function to return the appropriate icon.
(display-warning): Use 'warnings-get-icon'.
---
 lisp/emacs-lisp/warnings.el | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 6c77d57a6ba..626f0bccf2f 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -215,7 +215,7 @@ (defun warning-suppress-p (type suppress-list)
     ;; we return t.
     some-match))
 
-(define-icon warnings-suppress button
+(define-icon warnings-suppress-stop button
   `((emoji "⛔")
     ;; Many MS-Windows console fonts don't have good glyphs for U+25A0.
     (symbol ,(if (and (eq system-type 'windows-nt)
@@ -223,8 +223,20 @@ (define-icon warnings-suppress button
                  " » "
                " ■ "))
     (text " stop "))
+  "Suppress errors."
+  :version "31.1"
+  :help-echo "Click to suppress this warning type")
+
+(define-icon warnings-suppress-warn button
+  `((emoji "⚠️")
+    ;; Many MS-Windows console fonts don't have good glyphs for U+25A0.
+    (symbol ,(if (and (eq system-type 'windows-nt)
+                      (null window-system))
+                 " ! "
+               " ⏸ "))
+    (text " warn "))
   "Suppress warnings."
-  :version "29.1"
+  :version "31.1"
   :help-echo "Click to suppress this warning type")
 
 (defun warnings-suppress (type)
@@ -246,6 +258,13 @@ (defun warnings-suppress (type)
                                 (cons (list type) warning-suppress-types))))
     (_ (message "Exiting"))))
 
+(defun warnings-get-icon (level)
+  "Return appropriate icon for LEVEL of warning."
+  (icon-string
+   (if (memq level '(emergency :emergency error :error))
+       'warnings-suppress-stop
+     'warnings-suppress-warn)))
+
 ;;;###autoload
 (defun display-warning (type message &optional level buffer-name)
   "Display a warning message, MESSAGE.
@@ -324,7 +343,7 @@ (defun display-warning (type message &optional level buffer-name)
               ;; Don't output the button when doing batch compilation
               ;; and similar.
               (unless (or noninteractive (eq type 'bytecomp))
-                (insert (buttonize (icon-string 'warnings-suppress)
+                (insert (buttonize (warnings-get-icon level)
                                    #'warnings-suppress type)
                         " "))
 	      (if warning-prefix-function
-- 
2.39.5