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 13AA2431FC7
\r
6 for <notmuch@notmuchmail.org>; Sat, 18 May 2013 00:14:58 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 RdZ3g9mhtsNV for <notmuch@notmuchmail.org>;
\r
17 Sat, 18 May 2013 00:14:50 -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 3A41B431FC2
\r
22 for <notmuch@notmuchmail.org>; Sat, 18 May 2013 00:14:50 -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 1UdbLk-00038P-Kn; Sat, 18 May 2013 08:14:45 +0100
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1UdbLi-0003cM-R8; Sat, 18 May 2013 08:14:40 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH 3/5] emacs: Use async process helper for search
\r
34 In-Reply-To: <1368851472-5382-4-git-send-email-amdragon@mit.edu>
\r
35 References: <1368851472-5382-1-git-send-email-amdragon@mit.edu>
\r
36 <1368851472-5382-4-git-send-email-amdragon@mit.edu>
\r
37 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Sat, 18 May 2013 08:14:37 +0100
\r
40 Message-ID: <87d2sopxnm.fsf@qmul.ac.uk>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 X-Sender-Host-Address: 93.97.24.31
\r
44 X-QM-SPAM-Info: Sender has good ham record. :)
\r
45 X-QM-Body-MD5: f1931344fd78c5d3c2596f64ab6eb130 (of first 20000 bytes)
\r
46 X-SpamAssassin-Score: -0.3
\r
47 X-SpamAssassin-SpamBar: /
\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
50 spam. We require at least 5.0 points to mark a message as spam.
\r
51 This message scored -0.3 points.
\r
52 Summary of the scoring:
\r
53 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
54 provider * (markwalters1009[at]gmail.com)
\r
55 * -0.3 AWL AWL: From: address is in the auto white-list
\r
56 X-QM-Scan-Virus: ClamAV says the message is clean
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sat, 18 May 2013 07:14:58 -0000
\r
72 I have only very briefly looked at this: it seems to not quite apply to
\r
73 master (one fix up see below)
\r
75 Also, as far as I can see condition-case-unless-debug (used in patch
\r
76 2/5) is emacs 24 only.
\r
82 On Sat, 18 May 2013, Austin Clements <amdragon@MIT.EDU> wrote:
\r
83 > Previously, search started the async notmuch process directly. Now,
\r
84 > it uses `notmuch-start-notmuch'. This simplifies the process sentinel
\r
85 > a bit and means that we no longer have to worry about errors
\r
86 > interleaved with the JSON output.
\r
88 > We also update the tests of Emacs error handling, since the error
\r
89 > output is now separated from the search results buffer.
\r
91 > emacs/notmuch.el | 19 +++++--------------
\r
92 > test/emacs | 36 ++++++++++++++++++++++++++++++++----
\r
93 > 2 files changed, 37 insertions(+), 18 deletions(-)
\r
95 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
96 > index 4c1a6ca..b8d9c44 100644
\r
97 > --- a/emacs/notmuch.el
\r
98 > +++ b/emacs/notmuch.el
\r
99 > @@ -653,15 +653,8 @@ of the result."
\r
100 > ;; For version mismatch, there's no point in
\r
101 > ;; showing the search buffer
\r
102 > (when (or (= exit-status 20) (= exit-status 21))
\r
104 > - (condition-case err
\r
105 > - (notmuch-check-async-exit-status proc msg)
\r
106 > - ;; Suppress the error signal since strange
\r
107 > - ;; things happen if a sentinel signals. Mimic
\r
108 > - ;; the top-level's handling of error messages.
\r
110 > - (message "%s" (error-message-string err))
\r
113 (message "%s" (second err))
\r
117 > - (throw 'return nil)))
\r
119 > + (throw 'return nil))
\r
121 > (not (string= notmuch-search-target-thread "found")))
\r
122 > (set 'never-found-target-thread t)))))
\r
123 > @@ -938,10 +931,9 @@ Other optional parameters are used as follows:
\r
125 > (goto-char (point-min))
\r
127 > - (let ((proc (start-process
\r
128 > - "notmuch-search" buffer
\r
129 > - notmuch-command "search"
\r
130 > - "--format=json" "--format-version=1"
\r
131 > + (let ((proc (notmuch-start-notmuch
\r
132 > + "notmuch-search" buffer #'notmuch-search-process-sentinel
\r
133 > + "search" "--format=json" "--format-version=1"
\r
135 > "--sort=oldest-first"
\r
136 > "--sort=newest-first")
\r
137 > @@ -951,7 +943,6 @@ Other optional parameters are used as follows:
\r
138 > ;; should be called no matter how the process dies.
\r
139 > (parse-buf (generate-new-buffer " *notmuch search parse*")))
\r
140 > (process-put proc 'parse-buf parse-buf)
\r
141 > - (set-process-sentinel proc 'notmuch-search-process-sentinel)
\r
142 > (set-process-filter proc 'notmuch-search-process-filter)
\r
143 > (set-process-query-on-exit-flag proc nil))))
\r
144 > (run-hooks 'notmuch-search-hook)))
\r
145 > diff --git a/test/emacs b/test/emacs
\r
146 > index f033bdf..d38ae8c 100755
\r
149 > @@ -853,11 +853,10 @@ test_expect_success "Rendering HTML mail with images" \
\r
150 > 'cat OUTPUT && grep -q smiley OUTPUT'
\r
153 > -test_begin_subtest "Search handles subprocess errors"
\r
154 > +test_begin_subtest "Search handles subprocess error exit codes"
\r
155 > cat > notmuch_fail <<EOF
\r
157 > echo This is output
\r
158 > -echo This is an error >&2
\r
161 > chmod a+x notmuch_fail
\r
162 > @@ -874,8 +873,6 @@ sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
\r
163 > test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
\r
164 > Error: Unexpected output from notmuch search:
\r
166 > -Error: Unexpected output from notmuch search:
\r
167 > -This is an error
\r
168 > End of search results.
\r
170 > $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
\r
171 > @@ -885,4 +882,35 @@ $PWD/notmuch_fail exited with status 1
\r
172 > command: $PWD/notmuch_fail search --format\=json --format-version\=1 --sort\=newest-first tag\:inbox
\r
175 > +test_begin_subtest "Search handles subprocess warnings"
\r
176 > +cat > notmuch_fail <<EOF
\r
178 > +echo This is output
\r
179 > +echo This is a warning >&2
\r
180 > +echo This is another warning >&2
\r
183 > +chmod a+x notmuch_fail
\r
184 > +test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
\r
185 > + (with-current-buffer \"*Messages*\" (erase-buffer))
\r
186 > + (with-current-buffer \"*Notmuch errors*\" (erase-buffer))
\r
187 > + (notmuch-search \"tag:inbox\")
\r
188 > + (notmuch-test-wait)
\r
189 > + (with-current-buffer \"*Messages*\"
\r
190 > + (test-output \"MESSAGES\"))
\r
191 > + (with-current-buffer \"*Notmuch errors*\"
\r
192 > + (test-output \"ERROR\"))
\r
193 > + (test-output))"
\r
194 > +sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
\r
195 > +test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
\r
196 > +Error: Unexpected output from notmuch search:
\r
198 > +End of search results.
\r
200 > +This is a warning (see *Notmuch errors* for more details)
\r
203 > +This is a warning
\r
204 > +This is another warning"
\r