Subject: Re: bug#77917: 31.0.50; [PATCH] Stop using the "stop" sign for all warning levels

From: Juri Linkov <[email-masked]>
Date: Thu, 08 May 2025 09:45:38 +0300

>>> (define-icon warnings-suppress button
>>> -  `((emoji "⛔")
>>> +  `((emoji "⚠️")
> [...]
> Re-reading your patch, I realized your patch does exactly what
> I described.  Maybe we should rename the icon so it doesn’t say
> suppress.

Unfortunately, renaming an icon is not so simple.
First we need to mark an old name as obsolete
because very likely many users already customized it
with 'M-x customize-icon RET warnings-suppress RET'
that adds to the custom file a setting like this:

  (custom-set-icons
    '(warnings-suppress ((emoji "⚠️") (symbol " ■ ") (text " stop "))))

And I even don't know how to make it obsolete.
For example, there is 'define-obsolete-face-alias',
but no something like 'define-obsolete-icon-alias'.

> And for the symbol we could use ⚠.

Thanks.  I tried to find a suitable character for the symbol,
but didn't realize this could be used for it.

Here is the patch that also updates the docstring:

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 6c77d57a6ba..54a35fee3a9 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -216,15 +216,15 @@ warning-suppress-p
     some-match))
 
 (define-icon warnings-suppress button
-  `((emoji "⛔")
-    ;; Many MS-Windows console fonts don't have good glyphs for U+25A0.
+  `((emoji "⚠️")
+    ;; Many MS-Windows console fonts don't have good glyphs for symbols.
     (symbol ,(if (and (eq system-type 'windows-nt)
                       (null window-system))
                  " » "
-               " ■ "))
-    (text " stop "))
-  "Suppress warnings."
-  :version "29.1"
+               " ⚠ "))
+    (text " warning "))
+  "Indicate and optionally suppress warnings."
+  :version "31.1"
   :help-echo "Click to suppress this warning type")
 
 (defun warnings-suppress (type)
@@ -333,7 +333,16 @@ display-warning
 	      (insert (format (nth 1 level-info)
 			      (format warning-type-format typename))
 		      message)
-              (funcall newline)
+              ;; Don't output the buttons when doing batch compilation
+              ;; and similar.
+              (unless (or noninteractive (eq type 'bytecomp))
+                (insert " " (buttonize (propertize
+                                        "[Suppress]" 'face
+                                        '(variable-pitch (:height 0.9)))
+                                       #'warnings-suppress type)
+                        "\n"))
+              (unless (bolp)
+		(funcall newline))
 	      (when (and warning-fill-prefix
                          (not (string-search "\n" message))
                          (not noninteractive))