Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / d1 / 1f9a7d0339bff51b0807716805e2ab9a6800d3
1 Return-Path: <aneesh.kumar@linux.vnet.ibm.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id B5A8E431FBC\r
6         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 00:38:07 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id aqAiNv-xzSfP for <notmuch@notmuchmail.org>;\r
11         Sun, 22 Nov 2009 00:38:06 -0800 (PST)\r
12 Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143])\r
13         by olra.theworths.org (Postfix) with ESMTP id 87081431FAE\r
14         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 00:38:05 -0800 (PST)\r
15 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245])\r
16         by e23smtp01.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAM8aRqo020784\r
17         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 19:36:27 +1100\r
18 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139])\r
19         by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
20         nAM8c3x91016030\r
21         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 19:38:03 +1100\r
22 Received: from d23av04.au.ibm.com (loopback [127.0.0.1])\r
23         by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
24         nAM8c2Un029968\r
25         for <notmuch@notmuchmail.org>; Sun, 22 Nov 2009 19:38:03 +1100\r
26 Received: from localhost.localdomain ([9.77.209.175])\r
27         by d23av04.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
28         nAM8c1qb029958; Sun, 22 Nov 2009 19:38:01 +1100\r
29 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>\r
30 To: notmuch@notmuchmail.org\r
31 Date: Sun, 22 Nov 2009 14:07:56 +0530\r
32 Message-Id:\r
33  <1258879076-31883-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
34 X-Mailer: git-send-email 1.6.5.2.74.g610f9\r
35 Subject: [notmuch] [PATCH -v2] notmuch.el: Add face support to search and\r
36         show mode\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.12\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Sun, 22 Nov 2009 08:38:07 -0000\r
50 \r
51 This add two faces, notmuch-show-subject-face and\r
52 notmuch-tag-unread-face. The first face is used to show the subject\r
53 line in the notmuch-show-mode and the second one to show the unread\r
54 tag in the notmuch-search-mode. We can set additional tags by setting\r
55 notmuch-tag-face-alist as below\r
56 \r
57 (defface notmuch-tag-unread-face\r
58  '((((class color) (background light)) (:foreground "goldenrod" :bold t))\r
59     (((class color) (background dark)) (:foreground "goldenrod" :bold t)))\r
60   "Notmuch search mode face used to highligh tags.")\r
61 \r
62 (defface notmuch-tag-inbox-face\r
63  '((((class color) (background light)) (:foreground "red" :bold t))\r
64     (((class color) (background dark)) (:foreground "red" :bold t)))\r
65   "Notmuch search mode face used to highligh tags.")\r
66 \r
67 (setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face)\r
68                                  ("inbox" . 'notmuch-tag-inbox-face)))\r
69 (require 'notmuch)\r
70 \r
71 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
72 ---\r
73  notmuch.el |   36 ++++++++++++++++++++++++++++++++++--\r
74  1 files changed, 34 insertions(+), 2 deletions(-)\r
75 \r
76 diff --git a/notmuch.el b/notmuch.el\r
77 index 0144b61..a0f5aaa 100644\r
78 --- a/notmuch.el\r
79 +++ b/notmuch.el\r
80 @@ -637,6 +637,18 @@ which this thread was originally shown."\r
81    (force-window-update)\r
82    (redisplay t))\r
83  \r
84 +(defface notmuch-show-subject-face\r
85 + '((((class color) (background light)) (:foreground "yellow" :bold t))\r
86 +    (((class color) (background dark)) (:foreground "yellow" :bold t)))\r
87 +  "Notmuch show mode face used to highligh subject line."\r
88 +  :group 'notmuch)\r
89 +\r
90 +(defvar notmuch-show-font-lock-keywords\r
91 +  (list ;; header in font-lock-type-face\r
92 +   (list "\\(Subject:.*$\\)"\r
93 +        '(1  'notmuch-show-subject-face)))\r
94 +  "Additonal expression to hightlight in notmuch-show-mode")\r
95 +\r
96  ;;;###autoload\r
97  (defun notmuch-show-mode ()\r
98    "Major mode for viewing a thread with notmuch.\r
99 @@ -677,7 +689,9 @@ view, (remove the \"inbox\" tag from each), with\r
100    (use-local-map notmuch-show-mode-map)\r
101    (setq major-mode 'notmuch-show-mode\r
102         mode-name "notmuch-show")\r
103 -  (setq buffer-read-only t))\r
104 +  (setq buffer-read-only t)\r
105 +  (set (make-local-variable 'font-lock-defaults)\r
106 +         '(notmuch-show-font-lock-keywords t)))\r
107  \r
108  ;;;###autoload\r
109  \r
110 @@ -806,6 +820,17 @@ thread from that buffer can be show when done with this one)."\r
111    (goto-char (point-max))\r
112    (forward-line -1))\r
113  \r
114 +(defface notmuch-tag-unread-face\r
115 + '((((class color) (background light)) (:foreground "goldenrod" :bold t))\r
116 +    (((class color) (background dark)) (:foreground "goldenrod" :bold t)))\r
117 +  "Notmuch search mode face used to highligh tags."\r
118 +  :group 'notmuch)\r
119 +\r
120 +(defvar notmuch-tag-face-alist `(("unread" . 'notmuch-tag-unread-face))\r
121 +  "List containing the tag list that need to be highlighed")\r
122 +\r
123 +(defvar notmuch-search-font-lock-keywords  nil)\r
124 +\r
125  ;;;###autoload\r
126  (defun notmuch-search-mode ()\r
127    "Major mode for searching mail with notmuch.\r
128 @@ -836,7 +861,14 @@ global search.\r
129    (setq truncate-lines t)\r
130    (setq major-mode 'notmuch-search-mode\r
131         mode-name "notmuch-search")\r
132 -  (setq buffer-read-only t))\r
133 +  (setq buffer-read-only t)\r
134 +  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))\r
135 +  (loop for notmuch-search-tag  in notmuch-search-tags\r
136 +    do (add-to-list 'notmuch-search-font-lock-keywords (list\r
137 +                               (concat "\\(" notmuch-search-tag "\\)")\r
138 +                   `(1  ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))\r
139 +  (set (make-local-variable 'font-lock-defaults)\r
140 +         '(notmuch-search-font-lock-keywords t)))\r
141  \r
142  (defun notmuch-search-find-thread-id ()\r
143    (save-excursion\r
144 -- \r
145 1.6.5.2.74.g610f9\r
146 \r