Skip to content

Commit f45710e

Browse files
committed
Fontify the signature separator in Message mode
* lisp/gnus/message.el (message-signature-separator): New face (bug#17757). (message-font-lock-keywords): Add it to the signature, and ensure that the trailing space isn't removed when hitting RET. (message--match-signature): New helper function.
1 parent 6309cae commit f45710e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lisp/gnus/message.el

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,10 @@ starting with `not' and followed by regexps."
16581658
"Face used for displaying MML."
16591659
:group 'message-faces)
16601660

1661+
(defface message-signature-separator '((t :bold t))
1662+
"Face used for displaying the signature separator."
1663+
:group 'message-faces)
1664+
16611665
(defun message-match-to-eoh (_limit)
16621666
(let ((start (point)))
16631667
(rfc822-goto-eoh)
@@ -1751,9 +1755,22 @@ number of levels specified in the faces `message-cited-text-*'."
17511755
(0 ',cited-text-face))
17521756
keywords))
17531757
(setq level (1+ level)))
1754-
keywords))
1758+
keywords)
1759+
;; Match signature. This `field' stuff ensures that hitting `RET'
1760+
;; after the signature separator doesn't remove the trailing space.
1761+
(list
1762+
'(message--match-signature (0 '( face message-signature-separator
1763+
rear-nonsticky t
1764+
field signature)))))
17551765
"Additional expressions to highlight in Message mode.")
17561766

1767+
(defun message--match-signature (limit)
1768+
(save-excursion
1769+
(and (re-search-forward message-signature-separator limit t)
1770+
;; It's the last one in the buffer.
1771+
(not (save-excursion
1772+
(re-search-forward message-signature-separator nil t))))))
1773+
17571774
(defvar message-face-alist
17581775
'((bold . message-bold-region)
17591776
(underline . underline-region)

0 commit comments

Comments
 (0)