bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34898: 24.4; `message-separator' face only works for default value o


From: Basil L. Contovounesios
Subject: bug#34898: 24.4; `message-separator' face only works for default value of `mail-header-separator'
Date: Mon, 18 Mar 2019 17:01:30 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Eric Abrahamsen <address@hidden>
>> Date: Sun, 17 Mar 2019 19:59:41 -0700
>> 
>> >     So it's a bug.
>> 
>> The value of `mail-header-separator' gets added to
>> `message-font-lock-keywords', which does the actual fontification. Using
>> setq to change the value of `mail-header-separator' did not change the
>> font lock keyword, despite setting the variable before message.el is
>> loaded (or is it pre-loaded?). Using the customize interface to set
>> `mail-header-separator' *does* work as expected.
>
> Right.  So I don't think there's a bug here.

Actually, I think message-font-lock-keywords can do better:

>From 0aa67e4ac6cd2ac93c05c7b7bec486c5fefd12dd Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <address@hidden>
Date: Mon, 18 Mar 2019 15:09:45 +0000
Subject: [PATCH] Fix mail-header-separator font lock in message.el

* lisp/gnus/message.el (message-font-lock-keywords): Dynamically
font lock mail-header-separator, in case it changes. (bug#34898)
---
 lisp/gnus/message.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index c491f16dd8..079a13c706 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1599,19 +1599,21 @@ message-font-lock-keywords
        (progn (goto-char (match-beginning 0)) (match-end 0)) nil
         (1 'message-header-name)
         (2 'message-header-other nil t)))
-      ,@(if (and mail-header-separator
-                (not (equal mail-header-separator "")))
-           `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
-              1 'message-separator))
-         nil)
-      ((lambda (limit)
-        (re-search-forward (concat "^\\("
-                                   message-cite-prefix-regexp
-                                   "\\).*")
-                           limit t))
-       (0 'message-cited-text))
-      ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
-       (0 'message-mml))))
+      (,(lambda (limit)
+          (and mail-header-separator
+               (not (equal mail-header-separator ""))
+               (re-search-forward
+                (concat "^" (regexp-quote mail-header-separator) "$")
+                limit t)))
+       1 'message-separator)
+      (,(lambda (limit)
+          (re-search-forward (concat "^\\(?:"
+                                     message-cite-prefix-regexp
+                                     "\\).*")
+                             limit t))
+       0 'message-cited-text)
+      ("<#/?\\(?:multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>"
+       0 'message-mml)))
   "Additional expressions to highlight in Message mode.")
 
 (defvar message-face-alist
-- 
2.20.1

This is similar to what mail-font-lock-keywords does in
lisp/mail/sendmail.el, namely adapt the font lock keywords to changes in
mail-header-separator.

WDYT?

-- 
Basil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]