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

From: Juri Linkov <[email-masked]>
Date: Wed, 07 May 2025 20:22:24 +0300

>     >> I donʼt think we need the trailing space, but the rest looks good to
>     >> me.
>
>     Juri> I tried without the trailing space, but then an underline is added
>     Juri> at the end.  Very strange effect.  Maybe a bug?
>
> Some interaction between the `button' or `link' face from the
> `buttonize' with the :height spec?

Very interesting: 'display-warning' uses the function 'newline'
that basically does such a trick:

  (let ((last-command-event ?\n))
   (self-insert-command 1))

But the problem is that 'self-insert-command' inherits
the button text properties to the newline.  And with
these text properties the newline is displayed as
an underlined space character.

I don't know the reason why 'display-warning' uses 'newline',
but after replacing 'newline' with a plain "\n"
it is displayed correctly:

diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index 6c77d57a6ba..9714abea213 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -216,7 +216,7 @@ warning-suppress-p
     some-match))
 
 (define-icon warnings-suppress button
-  `((emoji "⛔")
+  `((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))
@@ -333,7 +333,14 @@ 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"))
 	      (when (and warning-fill-prefix
                          (not (string-search "\n" message))
                          (not noninteractive))