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 3F040431FC0 for ; Fri, 27 Nov 2009 22:07:16 -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 TUT2j5Trw+Hm for ; Fri, 27 Nov 2009 22:07:15 -0800 (PST) Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140]) by olra.theworths.org (Postfix) with ESMTP id D7812431FAE for ; Fri, 27 Nov 2009 22:07:14 -0800 (PST) Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp07.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAS67DeS018249 for ; Sat, 28 Nov 2009 17:07:13 +1100 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nAS63haA1634478 for ; Sat, 28 Nov 2009 17:03:43 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAS67C2v028104 for ; Sat, 28 Nov 2009 17:07:13 +1100 Received: from localhost.localdomain ([9.77.123.164]) by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nAS67AWi028095; Sat, 28 Nov 2009 17:07:11 +1100 From: "Aneesh Kumar K.V" To: cworth@cworth.org Date: Sat, 28 Nov 2009 11:37:05 +0530 Message-Id: <1259388425-32510-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.5.2.74.g610f9 In-Reply-To: <1259311332-14557-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1259311332-14557-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Cc: notmuch@notmuchmail.org Subject: [PATCH -v6] notmuch.el: Add face support to search 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: Sat, 28 Nov 2009 06:07:16 -0000 This patch use notmuch-tag-face showing 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)) (:foreground "goldenrod"))) "Notmuch search mode face used to highligh tags.") (defface notmuch-tag-inbox-face '((((class color)) (:foreground "red"))) "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 | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/notmuch.el b/notmuch.el index e9786c0..5cbfedf 100644 --- a/notmuch.el +++ b/notmuch.el @@ -846,6 +846,23 @@ 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) + (background dark)) + (:foreground "OliveDrab1")) + (((class color) + (background light)) + (:foreground "navy blue" :bold t)) + (t + (:bold t))) + "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. @@ -876,7 +893,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