From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1A469431FBF for ; Tue, 24 Nov 2009 20:58:11 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hOHz6nH1n6cu for ; Tue, 24 Nov 2009 20:58:10 -0800 (PST) Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) by olra.theworths.org (Postfix) with ESMTP id A486A431FAE for ; Tue, 24 Nov 2009 20:58:09 -0800 (PST) Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp08.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAPFw6Sr027971 for ; Thu, 26 Nov 2009 02:58:06 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nAP4w5Ci1777826 for ; Wed, 25 Nov 2009 15:58:05 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAP4w5wO010412 for ; Wed, 25 Nov 2009 15:58:05 +1100 Received: from localhost.localdomain ([9.124.31.111]) by d23av02.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nAP4w25A010362; Wed, 25 Nov 2009 15:58:03 +1100 From: "Aneesh Kumar K.V" To: notmuch@notmuchmail.org Date: Wed, 25 Nov 2009 10:28:00 +0530 Message-Id: <1259125080-18708-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.5.2.74.g610f9 Subject: [PATCH -v4] notmuch.el: Add face support to search and show mode X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 04:58:11 -0000 This add two faces, notmuch-show-subject-face and notmuch-tag-face. The first face is used to show the subject line in the notmuch-show-mode and the second one to show tags in the notmuch-search-mode. We can selectively highlight each tag by setting notmuch-tag-face-alist as below (defface notmuch-tag-unread-face '((((class color) (background light)) (:foreground "goldenrod" :bold t)) (((class color) (background dark)) (:foreground "goldenrod" :bold t))) "Notmuch search mode face used to highligh tags.") (defface notmuch-tag-inbox-face '((((class color) (background light)) (:foreground "red" :bold t)) (((class color) (background dark)) (:foreground "red" :bold t))) "Notmuch search mode face used to highligh tags.") (setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face) ("inbox" . 'notmuch-tag-inbox-face))) (require 'notmuch) Signed-off-by: Aneesh Kumar K.V --- notmuch.el | 38 ++++++++++++++++++++++++++++++++++++-- 1 files changed, 36 insertions(+), 2 deletions(-) diff --git a/notmuch.el b/notmuch.el index 551048a..5737f77 100644 --- a/notmuch.el +++ b/notmuch.el @@ -663,6 +663,17 @@ which this thread was originally shown." (notmuch-show-markup-message))) (notmuch-show-hide-markers)) +(defface notmuch-show-subject-face + '((((class color)) (:foreground "red"))) + "Notmuch show mode face used to highligh subject line." + :group 'notmuch) + +(defvar notmuch-show-font-lock-keywords + (list ;; header in font-lock-type-face + (list "\\(Subject:.*$\\)" + '(1 'notmuch-show-subject-face))) + "Additonal expression to hightlight in notmuch-show-mode") + ;;;###autoload (defun notmuch-show-mode () "Major mode for viewing a thread with notmuch. @@ -695,7 +706,9 @@ view, (remove the \"inbox\" tag from each), with (use-local-map notmuch-show-mode-map) (setq major-mode 'notmuch-show-mode mode-name "notmuch-show") - (setq buffer-read-only t)) + (setq buffer-read-only t) + (set (make-local-variable 'font-lock-defaults) + '(notmuch-show-font-lock-keywords t))) ;;;###autoload @@ -835,6 +848,16 @@ thread from that buffer can be show when done with this one)." (goto-char (point-max)) (forward-line -1)) +(defface notmuch-tag-face + '((((class color)) (:foreground "red"))) + "Notmuch search mode face used to highligh tags." + :group 'notmuch) + +(defvar notmuch-tag-face-alist nil + "List containing the tag list that need to be highlighed") + +(defvar notmuch-search-font-lock-keywords nil) + ;;;###autoload (defun notmuch-search-mode () "Major mode for searching mail with notmuch. @@ -865,7 +888,18 @@ global search. (setq truncate-lines t) (setq major-mode 'notmuch-search-mode mode-name "notmuch-search") - (setq buffer-read-only t)) + (setq buffer-read-only t) + (if (not notmuch-tag-face-alist) + (add-to-list 'notmuch-search-font-lock-keywords (list + "\\(([^)]*)$\\)" '(1 'notmuch-tag-face))) + (progn + (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)) + (loop for notmuch-search-tag in notmuch-search-tags + do (add-to-list 'notmuch-search-font-lock-keywords (list + (concat "\\(" notmuch-search-tag "\\)") + `(1 ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist)))))))) + (set (make-local-variable 'font-lock-defaults) + '(notmuch-search-font-lock-keywords t))) (defun notmuch-search-find-thread-id () "Return the thread for the current thread" -- 1.6.5.2.74.g610f9