1 Return-Path: <amdragon@mit.edu>
\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 F3069431FC9
\r
6 for <notmuch@notmuchmail.org>; Sat, 18 May 2013 13:14:14 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 jbNE9OOKbllV for <notmuch@notmuchmail.org>;
\r
16 Sat, 18 May 2013 13:14:04 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 598D2431FC2
\r
20 for <notmuch@notmuchmail.org>; Sat, 18 May 2013 13:14:03 -0700 (PDT)
\r
21 X-AuditID: 1209190f-b7f256d000005616-cd-5197e1095c86
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id AB.E5.22038.901E7915; Sat, 18 May 2013 16:14:01 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r4IKDxqS006974;
\r
27 Sat, 18 May 2013 16:14:00 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4IKDvPK021199
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Sat, 18 May 2013 16:13:58 -0400
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
35 (envelope-from <amdragon@MIT.EDU>)
\r
36 id 1UdnVt-0002qF-4P; Sat, 18 May 2013 16:13:57 -0400
\r
37 Date: Sat, 18 May 2013 16:13:57 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH 3/5] emacs: Use async process helper for search
\r
41 Message-ID: <20130518201356.GC5999@mit.edu>
\r
42 References: <1368851472-5382-1-git-send-email-amdragon@mit.edu>
\r
43 <1368851472-5382-4-git-send-email-amdragon@mit.edu>
\r
44 <87d2sopxnm.fsf@qmul.ac.uk>
\r
46 Content-Type: text/plain; charset=us-ascii
\r
47 Content-Disposition: inline
\r
48 In-Reply-To: <87d2sopxnm.fsf@qmul.ac.uk>
\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT1+V8OD3Q4EcXh8XquTwW12/OZHZg
\r
52 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mha93MNc0K9XMX2xZQPjVOUuRk4OCQETiclf
\r
53 X7JB2GISF+6tB7K5OIQE9jFKPN38mwnC2cgoceTvFVYI5zSTxOGmP1CZJYwSm7vXsoD0swio
\r
54 Skxc/54VxGYT0JDYtn85I4gtIqAjcfvQAnYQm1lAWuLb72YmEFtYwFmiZcJ8sBpeAW2J7qkL
\r
55 oDZMZpR49fY2M0RCUOLkzCcsEM1aEjf+vQRq5gAbtPwfB0iYE2jXmuc/wH4QFVCRmHJyG9sE
\r
56 RqFZSLpnIemehdC9gJF5FaNsSm6Vbm5iZk5xarJucXJiXl5qka6JXm5miV5qSukmRlBYc0ry
\r
57 72D8dlDpEKMAB6MSD+9H12mBQqyJZcWVuYcYJTmYlER5m25PDxTiS8pPqcxILM6ILyrNSS0+
\r
58 xCjBwawkwtsaBpTjTUmsrEotyodJSXOwKInzXk256S8kkJ5YkpqdmlqQWgSTleHgUJLgtXsA
\r
59 1ChYlJqeWpGWmVOCkGbi4AQZzgM0PAmkhre4IDG3ODMdIn+KUVFKnDcAJCEAksgozYPrhaWd
\r
60 V4ziQK8I88aAVPEAUxZc9yugwUxAg1mvTQUZXJKIkJJqYOTv/+yw2bvv2tzKWx9Lmraw1Uwx
\r
61 Yi053+q42n6rpkjCaY/Hy9keRWX/OhD30bGiNLIgT6k3/cYldpVpeqHTuabyhicp/4x94vta
\r
62 aufa5y67Z0y5mlGt5uX0eVdYRcftg9fLtIKnP0m93VdUvdn82eG9d7asFDe50bX5xNFE9TaO
\r
63 +CaH+xJJL5VYijMSDbWYi4oTAX5jlRMWAwAA
\r
64 Cc: notmuch@notmuchmail.org
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\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, 18 May 2013 20:14:15 -0000
\r
79 Quoth Mark Walters on May 18 at 8:14 am:
\r
81 > I have only very briefly looked at this: it seems to not quite apply to
\r
82 > master (one fix up see below)
\r
84 > Also, as far as I can see condition-case-unless-debug (used in patch
\r
85 > 2/5) is emacs 24 only.
\r
87 Indeed. I'll just use condition-case in v2 (unless we want to
\r
88 introduce a compatibility macro).
\r
90 I really wish the Emacs documentation included what version functions
\r
91 were introduced in. I couldn't even *find* a copy of the non-latest
\r
92 documentation; I wound up downloading a tarball of Emacs 23 and
\r
93 building the documentation myself.
\r
99 > On Sat, 18 May 2013, Austin Clements <amdragon@MIT.EDU> wrote:
\r
100 > > Previously, search started the async notmuch process directly. Now,
\r
101 > > it uses `notmuch-start-notmuch'. This simplifies the process sentinel
\r
102 > > a bit and means that we no longer have to worry about errors
\r
103 > > interleaved with the JSON output.
\r
105 > > We also update the tests of Emacs error handling, since the error
\r
106 > > output is now separated from the search results buffer.
\r
108 > > emacs/notmuch.el | 19 +++++--------------
\r
109 > > test/emacs | 36 ++++++++++++++++++++++++++++++++----
\r
110 > > 2 files changed, 37 insertions(+), 18 deletions(-)
\r
112 > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
113 > > index 4c1a6ca..b8d9c44 100644
\r
114 > > --- a/emacs/notmuch.el
\r
115 > > +++ b/emacs/notmuch.el
\r
116 > > @@ -653,15 +653,8 @@ of the result."
\r
117 > > ;; For version mismatch, there's no point in
\r
118 > > ;; showing the search buffer
\r
119 > > (when (or (= exit-status 20) (= exit-status 21))
\r
120 > > - (kill-buffer))
\r
121 > > - (condition-case err
\r
122 > > - (notmuch-check-async-exit-status proc msg)
\r
123 > > - ;; Suppress the error signal since strange
\r
124 > > - ;; things happen if a sentinel signals. Mimic
\r
125 > > - ;; the top-level's handling of error messages.
\r
127 > > - (message "%s" (error-message-string err))
\r
130 > (message "%s" (second err))
\r
133 Sorry, I thought these patches were independent from the ones I'd sent
\r
134 earlier, but obviously not. It should apply now that David has
\r
135 applied the other patch.
\r
137 > > - (throw 'return nil)))
\r
138 > > + (kill-buffer)
\r
139 > > + (throw 'return nil))
\r
141 > > (not (string= notmuch-search-target-thread "found")))
\r
142 > > (set 'never-found-target-thread t)))))
\r
143 > > @@ -938,10 +931,9 @@ Other optional parameters are used as follows:
\r
145 > > (goto-char (point-min))
\r
146 > > (save-excursion
\r
147 > > - (let ((proc (start-process
\r
148 > > - "notmuch-search" buffer
\r
149 > > - notmuch-command "search"
\r
150 > > - "--format=json" "--format-version=1"
\r
151 > > + (let ((proc (notmuch-start-notmuch
\r
152 > > + "notmuch-search" buffer #'notmuch-search-process-sentinel
\r
153 > > + "search" "--format=json" "--format-version=1"
\r
154 > > (if oldest-first
\r
155 > > "--sort=oldest-first"
\r
156 > > "--sort=newest-first")
\r
157 > > @@ -951,7 +943,6 @@ Other optional parameters are used as follows:
\r
158 > > ;; should be called no matter how the process dies.
\r
159 > > (parse-buf (generate-new-buffer " *notmuch search parse*")))
\r
160 > > (process-put proc 'parse-buf parse-buf)
\r
161 > > - (set-process-sentinel proc 'notmuch-search-process-sentinel)
\r
162 > > (set-process-filter proc 'notmuch-search-process-filter)
\r
163 > > (set-process-query-on-exit-flag proc nil))))
\r
164 > > (run-hooks 'notmuch-search-hook)))
\r
165 > > diff --git a/test/emacs b/test/emacs
\r
166 > > index f033bdf..d38ae8c 100755
\r
167 > > --- a/test/emacs
\r
168 > > +++ b/test/emacs
\r
169 > > @@ -853,11 +853,10 @@ test_expect_success "Rendering HTML mail with images" \
\r
170 > > 'cat OUTPUT && grep -q smiley OUTPUT'
\r
173 > > -test_begin_subtest "Search handles subprocess errors"
\r
174 > > +test_begin_subtest "Search handles subprocess error exit codes"
\r
175 > > cat > notmuch_fail <<EOF
\r
177 > > echo This is output
\r
178 > > -echo This is an error >&2
\r
181 > > chmod a+x notmuch_fail
\r
182 > > @@ -874,8 +873,6 @@ sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
\r
183 > > test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
\r
184 > > Error: Unexpected output from notmuch search:
\r
186 > > -Error: Unexpected output from notmuch search:
\r
187 > > -This is an error
\r
188 > > End of search results.
\r
190 > > $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
\r
191 > > @@ -885,4 +882,35 @@ $PWD/notmuch_fail exited with status 1
\r
192 > > command: $PWD/notmuch_fail search --format\=json --format-version\=1 --sort\=newest-first tag\:inbox
\r
193 > > exit status: 1"
\r
195 > > +test_begin_subtest "Search handles subprocess warnings"
\r
196 > > +cat > notmuch_fail <<EOF
\r
198 > > +echo This is output
\r
199 > > +echo This is a warning >&2
\r
200 > > +echo This is another warning >&2
\r
203 > > +chmod a+x notmuch_fail
\r
204 > > +test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
\r
205 > > + (with-current-buffer \"*Messages*\" (erase-buffer))
\r
206 > > + (with-current-buffer \"*Notmuch errors*\" (erase-buffer))
\r
207 > > + (notmuch-search \"tag:inbox\")
\r
208 > > + (notmuch-test-wait)
\r
209 > > + (with-current-buffer \"*Messages*\"
\r
210 > > + (test-output \"MESSAGES\"))
\r
211 > > + (with-current-buffer \"*Notmuch errors*\"
\r
212 > > + (test-output \"ERROR\"))
\r
213 > > + (test-output))"
\r
214 > > +sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
\r
215 > > +test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
\r
216 > > +Error: Unexpected output from notmuch search:
\r
217 > > +This is output
\r
218 > > +End of search results.
\r
220 > > +This is a warning (see *Notmuch errors* for more details)
\r
223 > > +This is a warning
\r
224 > > +This is another warning"
\r