[PATCH] lib: Invalidate message metadata in _notmuch_message_gen_terms
[notmuch-archives.git] / da / 4f461bf6d1c1bae5c8d373355c7d0a2aaec9ae
1 Return-Path: <jrollins@finestructure.net>\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 DE76C431FBD\r
6         for <notmuch@notmuchmail.org>; Thu,  4 Feb 2010 04:07:42 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -3.612\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-3.612 tagged_above=-999 required=5 tests=[AWL=0.387,\r
12         BAYES_50=0.001, RCVD_IN_DNSWL_MED=-4] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id mNoOE7EJzArN for <notmuch@notmuchmail.org>;\r
16         Thu,  4 Feb 2010 04:07:42 -0800 (PST)\r
17 Received: from brinza.cc.columbia.edu (brinza.cc.columbia.edu [128.59.29.8])\r
18         by olra.theworths.org (Postfix) with ESMTP id 11869431FAE\r
19         for <notmuch@notmuchmail.org>; Thu,  4 Feb 2010 04:07:42 -0800 (PST)\r
20 Received: from servo.finestructure.net (cpe-72-227-128-66.nyc.res.rr.com\r
21         [72.227.128.66])\r
22         (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0)\r
23         by brinza.cc.columbia.edu (8.14.3/8.14.3) with ESMTP id o14C7VaZ009976\r
24         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT)\r
25         for <notmuch@notmuchmail.org>; Thu, 4 Feb 2010 07:07:36 -0500 (EST)\r
26 Received: from jrollins by servo.finestructure.net with local (Exim 4.71)\r
27         (envelope-from <jrollins@finestructure.net>) id 1Nd0Ud-0004a8-R2\r
28         for notmuch@notmuchmail.org; Thu, 04 Feb 2010 07:07:31 -0500\r
29 From: Jameson Rollins <jrollins@finestructure.net>\r
30 To: Notmuch Mail <notmuch@notmuchmail.org>\r
31 Date: Thu, 04 Feb 2010 07:07:26 -0500\r
32 Message-ID: <87aavpb3wh.fsf@servo.finestructure.net>\r
33 MIME-Version: 1.0\r
34 Content-Type: multipart/signed; boundary="=-=-=";\r
35         micalg=pgp-sha256; protocol="application/pgp-signature"\r
36 X-No-Spam-Score: Local\r
37 X-Scanned-By: MIMEDefang 2.68 on 128.59.29.8\r
38 Subject: [notmuch] [PATCH] notmuch.el: colorize lines in notmuch-search\r
39         based on thread tags.\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Thu, 04 Feb 2010 12:07:43 -0000\r
53 \r
54 --=-=-=\r
55 Content-Transfer-Encoding: quoted-printable\r
56 \r
57 Arbitrary font faces can be specified for given thread tags.  By\r
58 default, no coloring is applied.  To specify coloring, place something\r
59 like this in your .emacs:\r
60 \r
61 (setq notmuch-search-line-faces '(("delete" . '(:foreground "red"))\r
62                                   ("unread" . '(:foreground "green"))))\r
63 \r
64 Order matters: line faces listed first will take precedence (in the\r
65 example above, a thread tagged both "delete" and "unread" will be\r
66 colored red, since the "delete" face is listed before the "unread").\r
67 =2D--\r
68  notmuch.el |   33 ++++++++++++++++++++++++++++++++-\r
69  1 files changed, 32 insertions(+), 1 deletions(-)\r
70 \r
71 diff --git a/notmuch.el b/notmuch.el\r
72 index a21c6a6..4f8840a 100644\r
73 =2D-- a/notmuch.el\r
74 +++ b/notmuch.el\r
75 @@ -1203,6 +1203,35 @@ This function advances the next thread when finished=\r
76 ."\r
77                             (insert (format " (process returned %d)" exit-status)))\r
78                         (insert "\n"))))))))))\r
79 =20\r
80 +(defcustom notmuch-search-line-faces nil\r
81 +  "Tag/face mapping for line highlighting in notmuch-search.\r
82 +\r
83 +Here is an example of how to color search results based on tags.\r
84 +(the following text would be placed in your ~/.emacs file):\r
85 +\r
86 +(setq notmuch-search-line-faces '((\"delete\" . '(:foreground \"red\"))\r
87 +                                 (\"unread\" . '(:foreground \"green\"))))\r
88 +\r
89 +Order matters: for lines with multiple tags, the the first\r
90 +matching will be applied."\r
91 +  :type '(alist :key-type (string) :value-type (list))\r
92 +  :group 'notmuch)\r
93 +\r
94 +(defun notmuch-search-color-line (start end line-tag-list)\r
95 +  "Colorize lines in notmuch-show based on tags"\r
96 +  (if notmuch-search-line-faces\r
97 +      (let ((overlay (make-overlay start end))\r
98 +           (tags-faces (copy-alist notmuch-search-line-faces)))\r
99 +       (while tags-faces\r
100 +         (let* ((tag-face (car tags-faces))\r
101 +                (tag (car tag-face))\r
102 +                (face (cdr tag-face)))\r
103 +           (cond ((member tag line-tag-list)\r
104 +                  (overlay-put overlay 'face face)\r
105 +                  (setq tags-faces nil))\r
106 +                 (t\r
107 +                  (setq tags-faces (cdr tags-faces)))))))))\r
108 +\r
109  (defun notmuch-search-process-filter (proc string)\r
110    "Process and filter the output of \"notmuch search\""\r
111    (let ((buffer (process-buffer proc)))\r
112 @@ -1220,12 +1249,14 @@ This function advances the next thread when finishe=\r
113 d."\r
114                            (authors (match-string 4 string))\r
115                            (authors-length (length authors))\r
116                            (subject (match-string 5 string))\r
117 =2D                        (tags (match-string 6 string)))\r
118 +                          (tags (match-string 6 string))\r
119 +                          (tag-list (if tags (save-match-data (split-string tags)))))\r
120                       (if (> authors-length 40)\r
121                           (set 'authors (concat (substring authors 0 (- 40 3)) "...")))\r
122                       (goto-char (point-max))\r
123                       (let ((beg (point-marker)))\r
124                         (insert (format "%s %-7s %-40s %s (%s)\n" date count authors subject ta=\r
125 gs))\r
126 +                       (notmuch-search-color-line beg (point-marker) tag-list)\r
127                         (put-text-property beg (point-marker) 'notmuch-search-thread-id thread-=\r
128 id)\r
129                         (put-text-property beg (point-marker) 'notmuch-search-authors authors)\r
130                         (put-text-property beg (point-marker) 'notmuch-search-subject subject))\r
131 =2D-=20\r
132 1.6.5\r
133 \r
134 \r
135 --=-=-=\r
136 Content-Type: application/pgp-signature\r
137 \r
138 -----BEGIN PGP SIGNATURE-----\r
139 Version: GnuPG v1.4.10 (GNU/Linux)\r
140 \r
141 iQIcBAEBCAAGBQJLarh+AAoJEO00zqvie6q86cAP/1ZRLQUNWqNfiem5zX+vxeqV\r
142 UzrtRZoIhWPZdyxKs1ty0K7AZD/lYySHrpS/sYkkQFEVOzxwdN4oNxU8FulZjGBe\r
143 mp3bKAgTxqAx2zKNuXFxgKdrnAMfhaAlTtYj2Tsm55XZgiEa7Cf+3Mjuy3Rr1ABO\r
144 uRjDCggCGkLaZpLIuSe9ZjcnKC2fFnnkKcxhsebdpgoTbVtxVkU6LpAeoWonQiQT\r
145 DAXIVi1uBcTynr8r/xZkPT7OL09D28eLHJGKMnh427a+l5u1kW+yb9qsPGkLmKcT\r
146 uBgJctsu4zqVAdmLHqCYJW625wfeQji8Zw0Btwc7n8x9uCdUhzaFnGmVde3NFt/F\r
147 LkVPQzoJIU/Y7Me6bHp64CUr/BZiWkZsFYwcvQlB5E1NDTQH4663p+IBgGECVwbJ\r
148 8MOhuQnqZj3lBW7a3mv+s93jxzaQ/Bh4SmqRE3KiajEGQXfcGJY21Pb0GooEB0m2\r
149 He9pdEIjVDcAUjXopv2VdAro6DQBdBVv26Yht48MSk0TyljB1GtOtiRy2EzhxEqE\r
150 xFZgN2zuBSSPGLUX+nqSbKTvdLjlf72pR2vUBU/dQxywfsPQaqJyR5Inq8R4a/1k\r
151 GE/UMxwwPB4e7j1reD88J24EevxBD90fYzb/Kz7oQ6+V1lFxIIP8gpEABViroAg5\r
152 oQ8nP2fGHJaEzDK/LHRI\r
153 =PXBd\r
154 -----END PGP SIGNATURE-----\r
155 --=-=-=--\r