unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: notmuch@notmuchmail.org
Subject: [PATCH -v6] notmuch.el: Use message-mode font-face to highlight mail headers
Date: Fri, 27 Nov 2009 15:44:13 +0530	[thread overview]
Message-ID: <1259316853-17725-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1259311332-14557-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

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

diff --git a/notmuch.el b/notmuch.el
index d2ebb40..b089732 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -604,6 +604,32 @@ 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))
+    (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)
   (re-search-forward notmuch-show-header-begin-regexp)
@@ -624,8 +650,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

  reply	other threads:[~2009-11-27 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25  4:58 [PATCH -v4] notmuch.el: Add face support to search and show mode Aneesh Kumar K.V
2009-11-25  5:24 ` Alexander Botero-Lowry
2009-11-25 14:33   ` Jeffrey Ollie
2009-11-25 15:32     ` Bart Trojanowski
2009-11-25 15:47   ` Aneesh Kumar K. V
2009-11-27  8:42 ` [PATCH -v5] notmuch.el: Add face support to search mode Aneesh Kumar K.V
2009-11-27  8:42   ` [PATCH -v5] notmuch.el: Use message-mode font-face to highlight mail headers Aneesh Kumar K.V
2009-11-27 10:14     ` Aneesh Kumar K.V [this message]
2009-11-28  5:02       ` [PATCH -v6] " Carl Worth
2009-11-28  6:07   ` [PATCH -v6] notmuch.el: Add face support to search mode Aneesh Kumar K.V
2009-11-28  6:56     ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259316853-17725-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).