[notmuch] [PATCH -v5] notmuch.el: Use message-mode font-face to highlight mail headers

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Fri Nov 27 00:42:12 PST 2009


Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
---
 notmuch.el |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 89ccef6..851c60c 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -595,6 +595,38 @@ which this thread was originally shown."
       (set-marker beg 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)))
+    (beginning-of-line)
+    (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)))
+    (beginning-of-line)
+    (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)))
+    (beginning-of-line)
+    (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)))
+    (beginning-of-line)
+
+))
 
 (defun notmuch-show-markup-header (depth)
   (re-search-forward notmuch-show-header-begin-regexp)
@@ -615,8 +647,7 @@ which this thread was originally shown."
         (forward-line)
         (while (looking-at "[A-Za-z][-A-Za-z0-9]*:")
           (beginning-of-line)
-          (overlay-put (make-overlay (point) (re-search-forward ":"))
-                       'face 'bold)
+	  (notmuch-fontify-headers)
           (forward-line)
           )
 	(indent-rigidly beg end depth)
-- 
1.6.5.2.74.g610f9



More information about the notmuch mailing list