[PATCH 1/9] lib: read "property" terms from messages.
[notmuch-archives.git] / 5e / 08149b257a637717c35890c32907b5dfe5dab5
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 1FE8E431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 25 Nov 2009 07:47:57 -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 IXorW4UGkmZt for <notmuch@notmuchmail.org>;\r
11         Wed, 25 Nov 2009 07:47:56 -0800 (PST)\r
12 Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145])\r
13         by olra.theworths.org (Postfix) with ESMTP id E0C0F431FAE\r
14         for <notmuch@notmuchmail.org>; Wed, 25 Nov 2009 07:47:55 -0800 (PST)\r
15 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
16         by e23smtp03.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAPFjB7P025094\r
17         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 02:45:11 +1100\r
18 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])\r
19         by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
20         nAPFiRfU1667228\r
21         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 02:44:27 +1100\r
22 Received: from d23av02.au.ibm.com (loopback [127.0.0.1])\r
23         by d23av02.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
24         nAPFlrNR007502\r
25         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 02:47:53 +1100\r
26 Received: from skywalker.linux.vnet.ibm.com ([9.77.208.221])\r
27         by d23av02.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
28         nAPFllkq007471; Thu, 26 Nov 2009 02:47:48 +1100\r
29 From: "Aneesh Kumar K. V" <aneesh.kumar@linux.vnet.ibm.com>\r
30 To: Alexander Botero-Lowry <alex.boterolowry@gmail.com>,\r
31         notmuch@notmuchmail.org\r
32 In-Reply-To:\r
33  <86fx83qirs.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me>\r
34 References:\r
35  <1259125080-18708-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
36         <86fx83qirs.fsf@fortitudo.i-did-not-set--mail-host-address--so-tickle-me>\r
37 Date: Wed, 25 Nov 2009 21:17:46 +0530\r
38 Message-ID: <87ocmqvc65.fsf@linux.vnet.ibm.com>\r
39 MIME-Version: 1.0\r
40 Content-Type: text/plain; charset=us-ascii\r
41 Subject: Re: [notmuch] [PATCH -v4] notmuch.el: Add face support to search\r
42  and show mode\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.12\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Wed, 25 Nov 2009 15:47:57 -0000\r
56 \r
57 On Tue, 24 Nov 2009 21:24:07 -0800, Alexander Botero-Lowry <alex.boterolowry@gmail.com> wrote:\r
58 > On Wed, 25 Nov 2009 10:28:00 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:\r
59 > > This add two faces, notmuch-show-subject-face and\r
60 > > notmuch-tag-face. The first face is used to show the subject\r
61 > > line in the notmuch-show-mode and the second one to show tags\r
62 > > in the notmuch-search-mode.\r
63 > > \r
64 > First, I definetly think fontification is the way to go instead of\r
65 > the adhoc/crappy way that cworth and I have been doing this in the\r
66 > past.\r
67\r
68 > [snip]\r
69\r
70 > > +(defvar notmuch-show-font-lock-keywords\r
71 > > +  (list ;; header in font-lock-type-face\r
72 > > +   (list "\\(Subject:.*$\\)"\r
73 > > +    '(1  'notmuch-show-subject-face)))\r
74 > > +  "Additonal expression to hightlight in notmuch-show-mode")\r
75 > > +\r
76 > So what happens if I have Subject: xxxx in my message?\r
77 \r
78 It will highlight them too. I initially tried to highlight it only\r
79 in the header fields. But then my elisp is not good to find out\r
80 how to do it for the full message. That is we need to search the\r
81 header area of each message and highlight specific fields. And all\r
82 the message fall in the same buffer. \r
83 \r
84 \r
85 > We already ran\r
86 > into a problem where a patch sent the list that included notmuch control\r
87 > character caused it to go into an infinite loop, I'd prefer our\r
88 > fontification code be a bit more resilient. At the very least this\r
89 > should use the font-lock syntax tables stuff to only do header\r
90 > fontification when inside the header block. This would probably require\r
91 > that fontification occur before the message is post-processed by \r
92 > notmuch-show to remove the section markers etc.\r
93 \r
94 Highlighting specific part of the email should not get any trouble\r
95 like infinite loop. Unless somebody figure out how to make elisp \r
96 highlight specific area, it would be nice to have the patch applied.\r
97 I really found it to help me when reading mails.\r
98 \r
99 \r
100\r
101 > Also +1 for more subduded colors than red. :) Possibly consider copying\r
102 > the message-mode colors, so that there is a bit of consistency between\r
103 > sending and viewing mail? Might even be able to steal the message-mode\r
104 > faces by importing their symbols.\r
105\r
106 \r
107 I use yellow with black background. It is difficult to find a color that\r
108 everybody likes. Infact once of the reason the patch was not applied\r
109 till now was yellow may the subject line not readable. So i went for\r
110 read which kind of looked fine with white background.\r
111 \r
112 \r
113 \r
114 > [snip]\r
115\r
116 > >  (defun notmuch-search-mode ()\r
117 > >    "Major mode for searching mail with notmuch.\r
118 > > @@ -865,7 +888,18 @@ global search.\r
119 > >    (setq truncate-lines t)\r
120 > >    (setq major-mode 'notmuch-search-mode\r
121 > >     mode-name "notmuch-search")\r
122 > > -  (setq buffer-read-only t))\r
123 > > +  (setq buffer-read-only t)\r
124 > > +  (if (not notmuch-tag-face-alist)\r
125 > > +      (add-to-list 'notmuch-search-font-lock-keywords (list\r
126 > > +           "\\(([^)]*)$\\)" '(1  'notmuch-tag-face)))\r
127 > This way of detecting the tags seems ok, but I think it would be nicer\r
128 > if it could be done even more deterministically. :) One idea that be\r
129 > neat is to have a --format=sexp for notmuch search, which exports sexps\r
130 > (probably alists, but could be some other format) for the search results\r
131 > that can just be eval'd and processed in a cleaner way (and would also\r
132 > make for nicer APIs in emacs for querying notmuch itself). Actually I\r
133 > really like the idea of a sexp output mode for show too, instead of the\r
134 > markers.... *plots*\r
135\r
136 > > +    (progn\r
137 > > +  (setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))\r
138 > > +  (loop for notmuch-search-tag  in notmuch-search-tags\r
139 > > +    do (add-to-list 'notmuch-search-font-lock-keywords (list\r
140 > > +                           (concat "\\(" notmuch-search-tag "\\)")\r
141 > > +               `(1  ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))\r
142 > > +  (set (make-local-variable 'font-lock-defaults)\r
143 > > +         '(notmuch-search-font-lock-keywords t)))\r
144 > >  \r
145 > I don't really see the point of fontifying all tags the same way if no\r
146 > tag-faces have been set, especially if none of the rest of the search\r
147 > results are fontified.\r
148 \r
149 This was done as per Carl's request. The idea was to make tags stand out\r
150 from rest of the subject. \r
151 \r
152 -aneesh\r