notmuch.el: Use message-mode font-face to highlight mail headers

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
Aneesh Kumar K.V 2009-11-27 15:44:13 +05:30 committed by Carl Worth
parent 6da6566576
commit 8418dee2f6

View file

@ -627,6 +627,32 @@ which this thread was originally shown."
(set-marker beg nil) (set-marker beg nil)
(set-marker end nil) (set-marker end nil)
))) )))
(defun notmuch-fontify-headers ()
(progn
(if (looking-at "[Tt]o:")
(progn
(overlay-put (make-overlay (point) (re-search-forward ":"))
'face 'message-header-name)
(overlay-put (make-overlay (point) (re-search-forward ".*$"))
'face 'message-header-to))
(if (looking-at "[B]?[Cc][Cc]:")
(progn
(overlay-put (make-overlay (point) (re-search-forward ":"))
'face 'message-header-name)
(overlay-put (make-overlay (point) (re-search-forward ".*$"))
'face 'message-header-cc))
(if (looking-at "[Ss]ubject:")
(progn
(overlay-put (make-overlay (point) (re-search-forward ":"))
'face 'message-header-name)
(overlay-put (make-overlay (point) (re-search-forward ".*$"))
'face 'message-header-subject))
(if (looking-at "[Ff]rom:")
(progn
(overlay-put (make-overlay (point) (re-search-forward ":"))
'face 'message-header-name)
(overlay-put (make-overlay (point) (re-search-forward ".*$"))
'face 'message-header-other))))))))
(defun notmuch-show-markup-header (depth) (defun notmuch-show-markup-header (depth)
(re-search-forward notmuch-show-header-begin-regexp) (re-search-forward notmuch-show-header-begin-regexp)
@ -647,8 +673,7 @@ which this thread was originally shown."
(forward-line) (forward-line)
(while (looking-at "[A-Za-z][-A-Za-z0-9]*:") (while (looking-at "[A-Za-z][-A-Za-z0-9]*:")
(beginning-of-line) (beginning-of-line)
(overlay-put (make-overlay (point) (re-search-forward ":")) (notmuch-fontify-headers)
'face 'bold)
(forward-line) (forward-line)
) )
(indent-rigidly beg end depth) (indent-rigidly beg end depth)