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 80D9C431FC0
\r
6 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 01:33:43 -0800 (PST)
\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 HWGyivWwFFVF for <notmuch@notmuchmail.org>;
\r
17 Sat, 15 Dec 2012 01:33:42 -0800 (PST)
\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 B42B9431FBF
\r
22 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 01:33:42 -0800 (PST)
\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 1Tjo7p-0007I9-4L; Sat, 15 Dec 2012 09:33:41 +0000
\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.69)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1Tjo7o-0006bT-RC; Sat, 15 Dec 2012 09:33:41 +0000
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH 6/7] emacs: Use unified error handling in search
\r
34 In-Reply-To: <1355548513-10085-7-git-send-email-amdragon@mit.edu>
\r
35 References: <1355548513-10085-1-git-send-email-amdragon@mit.edu>
\r
36 <1355548513-10085-7-git-send-email-amdragon@mit.edu>
\r
37 User-Agent: Notmuch/0.14+155~g7edfdc3 (http://notmuchmail.org) Emacs/23.4.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Sat, 15 Dec 2012 09:33:42 +0000
\r
40 Message-ID: <8738z7hd6x.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: db77e9b5c352b29a515faba4176923d6 (of first 20000 bytes)
\r
46 X-SpamAssassin-Score: -1.8
\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 -1.8 points.
\r
52 Summary of the scoring:
\r
53 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
55 * [138.37.6.40 listed in list.dnswl.org]
\r
56 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
57 provider * (markwalters1009[at]gmail.com)
\r
58 * 0.5 AWL AWL: From: address is in the auto white-list
\r
59 X-QM-Scan-Virus: ClamAV says the message is clean
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Sat, 15 Dec 2012 09:33:43 -0000
\r
75 On Sat, 15 Dec 2012, Austin Clements <amdragon@MIT.EDU> wrote:
\r
76 > This slightly changes the output of an existing test since we now
\r
77 > report non-zero exits with a pop-up buffer instead of at the end of
\r
78 > the search results.
\r
80 > emacs/notmuch-lib.el | 13 +++++++++++++
\r
81 > emacs/notmuch.el | 13 ++++++++-----
\r
82 > test/emacs-large-search-buffer | 2 +-
\r
83 > 3 files changed, 22 insertions(+), 6 deletions(-)
\r
85 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
86 > index 9222de8..cf61635 100644
\r
87 > --- a/emacs/notmuch-lib.el
\r
88 > +++ b/emacs/notmuch-lib.el
\r
89 > @@ -332,6 +332,19 @@ the user dismisses it."
\r
90 > (goto-char (point-min))))
\r
91 > (pop-to-buffer buf)))
\r
93 > +(defun notmuch-check-async-exit-status (proc msg)
\r
94 > + "If PROC exited abnormally, pop up an error buffer and signal an error.
\r
96 > +This is a wrapper around `notmuch-check-exit-status' for
\r
97 > +asynchronous process sentinels. PROC and MSG must be the
\r
98 > +arguments passed to the sentinel."
\r
99 > + (let ((exit-status
\r
100 > + (case (process-status proc)
\r
101 > + ((exit) (process-exit-status proc))
\r
102 > + ((signal) msg))))
\r
103 > + (when exit-status
\r
104 > + (notmuch-check-exit-status exit-status (process-command proc)))))
\r
106 > (defun notmuch-check-exit-status (exit-status command &optional output err-file)
\r
107 > "If EXIT-STATUS is non-zero, pop up an error buffer and signal an error.
\r
109 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
110 > index e25b54e..c20de13 100644
\r
111 > --- a/emacs/notmuch.el
\r
112 > +++ b/emacs/notmuch.el
\r
113 > @@ -637,6 +637,7 @@ of the result."
\r
114 > (exit-status (process-exit-status proc))
\r
115 > (never-found-target-thread nil))
\r
116 > (when (memq status '(exit signal))
\r
118 > (kill-buffer (process-get proc 'parse-buf))
\r
119 > (if (buffer-live-p buffer)
\r
120 > (with-current-buffer buffer
\r
121 > @@ -647,17 +648,19 @@ of the result."
\r
122 > (if (eq status 'signal)
\r
123 > (insert "Incomplete search results (search process was killed).\n"))
\r
124 > (when (eq status 'exit)
\r
125 > - (insert "End of search results.")
\r
126 > - (unless (= exit-status 0)
\r
127 > - (insert (format " (process returned %d)" exit-status)))
\r
129 > + (insert "End of search results.\n")
\r
130 > + (condition-case err
\r
131 > + (notmuch-check-async-exit-status proc msg)
\r
132 > + ;; Suppress the error signal since strange
\r
133 > + ;; things happen if a sentinel signals.
\r
134 > + (error (throw 'return nil)))
\r
136 A total triviality (mostly just to check that I am understanding these
\r
137 parts): is the "err" after the condition-case used/needed?
\r
143 > (not (string= notmuch-search-target-thread "found")))
\r
144 > (set 'never-found-target-thread t)))))
\r
145 > (when (and never-found-target-thread
\r
146 > notmuch-search-target-line)
\r
147 > (goto-char (point-min))
\r
148 > - (forward-line (1- notmuch-search-target-line))))))))
\r
149 > + (forward-line (1- notmuch-search-target-line)))))))))
\r
151 > (defcustom notmuch-search-line-faces '(("unread" :weight bold)
\r
152 > ("flagged" :foreground "blue"))
\r
153 > diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-buffer
\r
154 > index 678328d..9dcbef5 100755
\r
155 > --- a/test/emacs-large-search-buffer
\r
156 > +++ b/test/emacs-large-search-buffer
\r
157 > @@ -36,7 +36,7 @@ test_emacs '(notmuch-search "--this-option-does-not-exist")
\r
158 > cat <<EOF >EXPECTED
\r
159 > Error: Unexpected output from notmuch search:
\r
160 > Unrecognized option: --this-option-does-not-exist
\r
161 > -End of search results. (process returned 1)
\r
162 > +End of search results.
\r
164 > test_expect_equal_file OUTPUT EXPECTED
\r