Subject: bug#59687: 30.0.50; whitespace-mode not working on message-mode

From: Gabriel <[email-masked]>
Date: Tue, 29 Nov 2022 15:42:34 -0300

Severity: bug

Description:

Some styles from whitespace-mode are not working properly when enabled
in message-mode and mail-user-agent is set to gnus-user-agent.

Steps:

1) emacs -Q (master "7939184f8e0370e7a3397d492812c6d202c2a193")

2) Eval the following to automatically enable whitespace-mode on
message-mode buffers:

(add-hook 'message-mode-hook #'whitespace-mode)

3) Compose new email with C-x m

Result: the whitespace-mode is enabled and the styles are properly
displayed, e.g., the red mark (trailing) on line 2 after the word "Subject: ".

4) Run Gnus with M-x gnus (ignore all errors, just make sure gnus is running)

5) Compose new email with C-x m

Result: the whitespace-mode is enabled and the styles are properly
displayed, e.g., the red mark (trailing) on line 2 after the word "Subject: ".

6) Eval the following to set mail-user-agent:

(setopt mail-user-agent 'gnus-user-agent)

7) Compose new email with C-x m

Result: the whitespace-mode is enabled but some styles are NOT properly
displayed, e.g., the red mark (trailing) on line 2 after the word
"Subject: " is missing.  The dot (space-mark) and the dollar sign
(newline-mark) are properly displayed.

8) Toggle whitespace-mode by executing twice M-x whitespace-mode

Result: the whitespace-mode is disabled and enabled, and now all styles
are properly displayed (as in steps 3 and 5).

Notes:

- The problem is not be reproduced if mail-user-agent is not set to
  gnus-user-agent.

- The problem is not reproduced if whitespace-mode is manually enabled
  in message-mode buffers (i.e., without using hook).

---
Gabriel