[PATCH 4/4] debian: update .gitignore
[notmuch-archives.git] / 1d / 69ed6ba993726ee1ef1cbd70cecb38b88c0113
1 Return-Path: <m.walters@qmul.ac.uk>\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 26152431FAF\r
6         for <notmuch@notmuchmail.org>; Sat,  7 Jul 2012 09:27:54 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id VY+IPOnP5Cm3 for <notmuch@notmuchmail.org>;\r
17         Sat,  7 Jul 2012 09:27:53 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id D09E9431FAE\r
22         for <notmuch@notmuchmail.org>; Sat,  7 Jul 2012 09:27:52 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1SnXrH-0004YR-62; Sat, 07 Jul 2012 17:27:47 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1SnXrG-0001gu-Hg; Sat, 07 Jul 2012 17:27:46 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>\r
34 Subject: Re: [PATCH v2 0/9] JSON-based search-mode\r
35 In-Reply-To: <20120706002941.GB18195@mit.edu>\r
36 References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
37         <1341521547-15502-1-git-send-email-amdragon@mit.edu>\r
38         <87y5mx3mtd.fsf@qmul.ac.uk> <20120706002941.GB18195@mit.edu>\r
39 User-Agent: Notmuch/0.13.2+61~gf708609 (http://notmuchmail.org) Emacs/23.4.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Sat, 07 Jul 2012 17:27:43 +0100\r
42 Message-ID: <87ipdztu2o.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 94.192.233.223\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: c61e9761cd6233d20595f9b9d6faad11 (of first 20000 bytes)\r
48 X-SpamAssassin-Score: -1.8\r
49 X-SpamAssassin-SpamBar: -\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored -1.8 points.\r
54         Summary of the scoring: \r
55         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
56         *      medium trust\r
57         *      [138.37.6.40 listed in list.dnswl.org]\r
58         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
59         provider *      (markwalters1009[at]gmail.com)\r
60         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
61         *      domain\r
62         *  0.5 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 Cc: tomi.ollila@iki.fi, notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Sat, 07 Jul 2012 16:27:54 -0000\r
78 \r
79 On Fri, 06 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
80 > Quoth Mark Walters on Jul 05 at 10:44 pm:\r
81 >> On Thu, 05 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
82 >> > This should account for all of Mark's and Tomi's comments.  This\r
83 >> > version\r
84 >> > * renames the "format" variables to "format-string" and "spec" to be\r
85 >> >   less confusing,\r
86 >> > * reverts to the original behavior of ignoring the user's format\r
87 >> >   specification for tags (since we make assumptions about this format\r
88 >> >   elsewhere),\r
89 >> > * swaps the error helper and search-target patches to fix the\r
90 >> >   temporary issue with error message placement,\r
91 >> > * adds documentation on point movement in the JSON parser,\r
92 >> > * breaks out the JSON EOF testing function,\r
93 >> > * beefs up a few commit messages,\r
94 >> > * and adds a NEWS patch.\r
95 >> >\r
96 >> > For ease of reviewing, the diff diff is below.\r
97 >> >\r
98 >> > I've written most of a follow-on patch series that cleans up the\r
99 >> > handling of metadata and tag changes by attaching the JSON result\r
100 >> > object to the result.  This means we don't need a proliferation of\r
101 >> > text properties to store the result metadata, and we can make updates\r
102 >> > to a result (e.g., tag changes) by updating this result object and\r
103 >> > then re-rendering the result line from scratch, rather than trying to\r
104 >> > update the result line in place.  This makes it possible to obey user\r
105 >> > formatting for the tag list and has other perks like recoloring\r
106 >> > results when their tags change.  I'll send it along once this patch\r
107 >> > series is accepted.\r
108 >> >\r
109 >> > diff --git a/NEWS b/NEWS\r
110 >> > index d29ec5b..a1a6e93 100644\r
111 >> > --- a/NEWS\r
112 >> > +++ b/NEWS\r
113 >> > @@ -14,6 +14,23 @@ Maildir tag synchronization\r
114 >> >    messages (typically causing new messages to not receive the "unread"\r
115 >> >    tag).\r
116 >> >  \r
117 >> > +Emacs Interface\r
118 >> > +---------------\r
119 >> > +\r
120 >> > +Search now uses the JSON format internally\r
121 >> > +\r
122 >> > +  This should address problems with unusual characters in authors and\r
123 >> > +  subject lines that could confuse the old text-based search parser.\r
124 >> > +\r
125 >> > +The date shown in search results is no longer padded before applying\r
126 >> > +user-specified formatting\r
127 >> > +\r
128 >> > +  Previously, the date in the search results was padded to fixed width\r
129 >> > +  before being formatted with `notmuch-search-result-format`.  It is\r
130 >> > +  no longer padded.  The default format has been updated, but if\r
131 >> > +  you've customized this variable, you may have to change your date\r
132 >> > +  format from `"%s "` to `"%12s "`.\r
133 >> > +\r
134 >> >  Notmuch 0.13.2 (2012-06-02)\r
135 >> >  ===========================\r
136 >> >  \r
137 >> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
138 >> > index f7cda33..9e04d97 100644\r
139 >> > --- a/emacs/notmuch-lib.el\r
140 >> > +++ b/emacs/notmuch-lib.el\r
141 >> > @@ -399,8 +399,9 @@ resynchronize after an error by moving point."\r
142 >> >  \r
143 >> >  Returns 'retry if there is insufficient input to parse the\r
144 >> >  beginning of the compound.  If this is able to parse the\r
145 >> > -beginning of a compound, it returns t and later calls to\r
146 >> > -`notmuch-json-read' will return the compound's elements.\r
147 >> > +beginning of a compound, it moves point past the token that opens\r
148 >> > +the compound and returns t.  Later calls to `notmuch-json-read'\r
149 >> > +will return the compound's elements.\r
150 >> >  \r
151 >> >  Entering JSON objects is current unimplemented."\r
152 >> >  \r
153 >> > @@ -423,7 +424,8 @@ Entering JSON objects is current unimplemented."\r
154 >> >  Returns 'retry if there is insufficient input to parse a complete\r
155 >> >  JSON value.  If the parser is currently inside a compound value\r
156 >> >  and the next token ends the list or object, returns 'end.\r
157 >> > -Otherwise, returns the value."\r
158 >> > +Otherwise, moves point to just past the end of the value and\r
159 >> > +returns the value."\r
160 >> \r
161 >> I think that point can move when 'retry is returned (past terminators\r
162 >> and commas for example). It might also be worth saying that it returns\r
163 >> the next value passing command and terminators and whitespace after\r
164 >> point.\r
165 >\r
166 > How about\r
167 >\r
168 > Returns 'retry if there is insufficient input to parse a complete JSON\r
169 > value (though it may still move point over separators or whitespace).\r
170 > If the parser is currently inside a compound value and the next token\r
171 > ends the list or object, this moves point just past the terminator and\r
172 > returns 'end.  Otherwise, this moves point to just past the end of the\r
173 > value and returns the value.\r
174 >\r
175 > ?\r
176 \r
177 This sounds good.\r
178 \r
179 >> >  \r
180 >> >    (with-current-buffer (notmuch-json-buffer jp)\r
181 >> >      (or\r
182 >> > @@ -474,11 +476,22 @@ Otherwise, returns the value."\r
183 >> >           (notmuch-json-partial-pos jp) nil\r
184 >> >           (notmuch-json-partial-state jp) nil)\r
185 >> >     ;; Parse the value\r
186 >> > -   (let* ((json-object-type 'plist)\r
187 >> > -          (json-array-type 'list)\r
188 >> > -          (json-false nil))\r
189 >> > +   (let ((json-object-type 'plist)\r
190 >> > +         (json-array-type 'list)\r
191 >> > +         (json-false nil))\r
192 >> >       (json-read)))))))\r
193 >> >  \r
194 >> > +(defun notmuch-json-eof (jp)\r
195 >> > +  "Signal a json-error if there is more input in JP's buffer.\r
196 >> \r
197 >> Would `data' be better than `input' (to distinguish allowed whitespace\r
198 >> from disallowed data)?\r
199 >\r
200 > Ah, yes.\r
201 >\r
202 >   "Signal a json-error if there is more data in JP's buffer.\r
203 >\r
204 > Moves point to the beginning of any trailing data or to the end\r
205 > of the buffer if there is only trailing whitespace."\r
206 >\r
207 > ?\r
208 \r
209 This is good too.\r
210 \r
211 >> > +Moves point to the beginning of any trailing garbage or to the\r
212 >> > +end of the buffer if there is no trailing garbage."\r
213 >> > +\r
214 >> > +  (with-current-buffer (notmuch-json-buffer jp)\r
215 >> > +    (skip-chars-forward " \t\r\n")\r
216 >> > +    (unless (eobp)\r
217 >> > +      (signal 'json-error (list "Trailing garbage following JSON data")))))\r
218 >> > +\r
219 >> >  (provide 'notmuch-lib)\r
220 >> >  \r
221 >> >  ;; Local Variables:\r
222 >> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
223 >> > index 2a09a98..fabb7c0 100644\r
224 >> > --- a/emacs/notmuch.el\r
225 >> > +++ b/emacs/notmuch.el\r
226 >> > @@ -702,28 +702,29 @@ non-authors is found, assume that all of the authors match."\r
227 >> >      (overlay-put overlay 'isearch-open-invisible #'delete-overlay)))\r
228 >> >        (insert padding))))\r
229 >> >  \r
230 >> > -(defun notmuch-search-insert-field (field format result)\r
231 >> > +(defun notmuch-search-insert-field (field format-string result)\r
232 >> >    (cond\r
233 >> >     ((string-equal field "date")\r
234 >> > -    (insert (propertize (format format (plist-get result :date_relative))\r
235 >> > +    (insert (propertize (format format-string (plist-get result :date_relative))\r
236 >> >                    'face 'notmuch-search-date)))\r
237 >> >     ((string-equal field "count")\r
238 >> > -    (insert (propertize (format format (format "[%s/%s]"\r
239 >> > -                                         (plist-get result :matched)\r
240 >> > -                                         (plist-get result :total)))\r
241 >> > +    (insert (propertize (format format-string\r
242 >> > +                          (format "[%s/%s]" (plist-get result :matched)\r
243 >> > +                                  (plist-get result :total)))\r
244 >> >                    'face 'notmuch-search-count)))\r
245 >> >     ((string-equal field "subject")\r
246 >> > -    (insert (propertize (format format (plist-get result :subject))\r
247 >> > +    (insert (propertize (format format-string (plist-get result :subject))\r
248 >> >                    'face 'notmuch-search-subject)))\r
249 >> >  \r
250 >> >     ((string-equal field "authors")\r
251 >> > -    (notmuch-search-insert-authors format (plist-get result :authors)))\r
252 >> > +    (notmuch-search-insert-authors format-string (plist-get result :authors)))\r
253 >> >  \r
254 >> >     ((string-equal field "tags")\r
255 >> > -    (insert\r
256 >> > -     (format format (propertize\r
257 >> > -               (mapconcat 'identity (plist-get result :tags) " ")\r
258 >> > -               'font-lock-face 'notmuch-tag-face))))))\r
259 >> > +    ;; Ignore format-string here because notmuch-search-set-tags\r
260 >> > +    ;; depends on the format of this\r
261 >> > +    (insert (concat "(" (propertize\r
262 >> > +                   (mapconcat 'identity (plist-get result :tags) " ")\r
263 >> > +                   'font-lock-face 'notmuch-tag-face) ")")))))\r
264 >> >  \r
265 >> >  (defun notmuch-search-show-result (result)\r
266 >> >    ;; Ignore excluded matches\r
267 >> > @@ -731,8 +732,8 @@ non-authors is found, assume that all of the authors match."\r
268 >> >      (let ((beg (point-max)))\r
269 >> >        (save-excursion\r
270 >> >    (goto-char beg)\r
271 >> > -  (dolist (format notmuch-search-result-format)\r
272 >> > -    (notmuch-search-insert-field (car format) (cdr format) result))\r
273 >> > +  (dolist (spec notmuch-search-result-format)\r
274 >> > +    (notmuch-search-insert-field (car spec) (cdr spec) result))\r
275 >> >    (insert "\n")\r
276 >> >    (notmuch-search-color-line beg (point) (plist-get result :tags))\r
277 >> >    (put-text-property beg (point) 'notmuch-search-thread-id\r
278 >> > @@ -790,11 +791,8 @@ non-authors is found, assume that all of the authors match."\r
279 >> >                 (otherwise (notmuch-search-show-result result)))))\r
280 >> >            ((end)\r
281 >> >             ;; Any trailing data is unexpected\r
282 >> > -           (with-current-buffer parse-buf\r
283 >> > -             (skip-chars-forward " \t\r\n")\r
284 >> > -             (if (eobp)\r
285 >> > -                 (setq done t)\r
286 >> > -               (signal 'json-error nil)))))\r
287 >> > +           (notmuch-json-eof notmuch-search-json-parser)\r
288 >> > +           (setq done t)))\r
289 >> \r
290 >> I think this used to only set `done' if there was not trailing data but\r
291 >> now does so anyway?\r
292 >\r
293 > It still won't set done if there's trailing data because\r
294 > notmuch-json-eof will signal an error, which will unwind to the\r
295 > condition-case (which will then consume said trailing data and done\r
296 > will get set on the next time through the loop).\r
297 \r
298 \r
299 Ah! I had overlooked that. It all looks good now.\r
300 \r
301 Best wishes\r
302 \r
303 Mark\r
304 \r