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

From: Yuan Fu <[email-masked]>
Date: Wed, 7 May 2025 22:10:39 -0700

> On May 7, 2025, at 10:22 AM, Juri Linkov <[email-masked]> wrote:
> 
>>>> 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))

Using ⚠️ to mean “suppress” feels wrong. Maybe just display the ⚠️ or ⛔ in front of the warning, and append the suppress button at the end of the message? (But doesn’t the warning buffer only display warning?)

Also can we replace the ■ symbol with ⊖ or ⛒? The ■ symbol is very confusing.

Yuan