[notmuch] [PATCH -v6] notmuch.el: Add face support to search mode
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Sat, 28 Nov 2009 06:07:05 +0000 (11:37 +0530)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:46 +0000 (09:35 -0800)
65/1e53f4cfe21815eabdb1452f1ad6c374d3fec9 [new file with mode: 0644]

diff --git a/65/1e53f4cfe21815eabdb1452f1ad6c374d3fec9 b/65/1e53f4cfe21815eabdb1452f1ad6c374d3fec9
new file mode 100644 (file)
index 0000000..91ae252
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <aneesh.kumar@linux.vnet.ibm.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3F040431FC0\r
+       for <notmuch@notmuchmail.org>; Fri, 27 Nov 2009 22:07:16 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id TUT2j5Trw+Hm for <notmuch@notmuchmail.org>;\r
+       Fri, 27 Nov 2009 22:07:15 -0800 (PST)\r
+Received: from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140])\r
+       by olra.theworths.org (Postfix) with ESMTP id D7812431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 27 Nov 2009 22:07:14 -0800 (PST)\r
+Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
+       by e23smtp07.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAS67DeS018249\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Nov 2009 17:07:13 +1100\r
+Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139])\r
+       by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
+       nAS63haA1634478\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Nov 2009 17:03:43 +1100\r
+Received: from d23av04.au.ibm.com (loopback [127.0.0.1])\r
+       by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
+       nAS67C2v028104\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Nov 2009 17:07:13 +1100\r
+Received: from localhost.localdomain ([9.77.123.164])\r
+       by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
+       nAS67AWi028095; Sat, 28 Nov 2009 17:07:11 +1100\r
+From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>\r
+To: cworth@cworth.org\r
+Date: Sat, 28 Nov 2009 11:37:05 +0530\r
+Message-Id:\r
+ <1259388425-32510-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
+X-Mailer: git-send-email 1.6.5.2.74.g610f9\r
+In-Reply-To:\r
+ <1259311332-14557-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
+References:\r
+ <1259311332-14557-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
+Cc: notmuch@notmuchmail.org\r
+Subject: [notmuch] [PATCH -v6] notmuch.el: Add face support to search mode\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 28 Nov 2009 06:07:16 -0000\r
+\r
+This patch use notmuch-tag-face showing tags in the notmuch-search-mode.\r
+\r
+We can selectively highlight each tag by setting notmuch-tag-face-alist as below\r
+\r
+(defface notmuch-tag-unread-face\r
+ '((((class color)) (:foreground "goldenrod")))\r
+  "Notmuch search mode face used to highligh tags.")\r
+\r
+(defface notmuch-tag-inbox-face\r
+ '((((class color)) (:foreground "red")))\r
+  "Notmuch search mode face used to highligh tags.")\r
+\r
+(setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)\r
+                              ("inbox" . 'notmuch-tag-inbox-face)))\r
+(require 'notmuch)\r
+\r
+Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
+---\r
+ notmuch.el |   30 +++++++++++++++++++++++++++++-\r
+ 1 files changed, 29 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/notmuch.el b/notmuch.el\r
+index e9786c0..5cbfedf 100644\r
+--- a/notmuch.el\r
++++ b/notmuch.el\r
+@@ -846,6 +846,23 @@ thread from that buffer can be show when done with this one)."\r
+   (goto-char (point-max))\r
+   (forward-line -1))\r
\r
++(defface notmuch-tag-face\r
++  '((((class color)\r
++      (background dark))\r
++     (:foreground "OliveDrab1"))\r
++    (((class color)\r
++      (background light))\r
++     (:foreground "navy blue" :bold t))\r
++    (t\r
++     (:bold t)))\r
++  "Notmuch search mode face used to highligh tags."\r
++  :group 'notmuch)\r
++\r
++(defvar notmuch-tag-face-alist nil\r
++  "List containing the tag list that need to be highlighed")\r
++\r
++(defvar notmuch-search-font-lock-keywords  nil)\r
++\r
+ ;;;###autoload\r
+ (defun notmuch-search-mode ()\r
+   "Major mode for searching mail with notmuch.\r
+@@ -876,7 +893,18 @@ global search.\r
+   (setq truncate-lines t)\r
+   (setq major-mode 'notmuch-search-mode\r
+       mode-name "notmuch-search")\r
+-  (setq buffer-read-only t))\r
++  (setq buffer-read-only t)\r
++  (if (not notmuch-tag-face-alist)\r
++      (add-to-list 'notmuch-search-font-lock-keywords (list\r
++              "(\\([^)]*\\))$" '(1  'notmuch-tag-face)))\r
++    (progn\r
++  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))\r
++  (loop for notmuch-search-tag  in notmuch-search-tags\r
++    do (add-to-list 'notmuch-search-font-lock-keywords (list\r
++                              (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")\r
++                  `(1  ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))\r
++  (set (make-local-variable 'font-lock-defaults)\r
++         '(notmuch-search-font-lock-keywords t)))\r
\r
+ (defun notmuch-search-find-thread-id ()\r
+   "Return the thread for the current thread"\r
+-- \r
+1.6.5.2.74.g610f9\r
+\r