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 479F6431FD7
\r
6 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:37 -0800 (PST)
\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 IWYJEpgXhICr for <notmuch@notmuchmail.org>;
\r
16 Sat, 15 Dec 2012 12:04:35 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 0A0F4431FBC
\r
20 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:34 -0800 (PST)
\r
21 X-AuditID: 12074424-b7fe06d0000008f0-e7-50ccd7d2e158
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id F0.64.02288.2D7DCC05; Sat, 15 Dec 2012 15:04:34 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qBFK4WeL022934;
\r
27 Sat, 15 Dec 2012 15:04:32 -0500
\r
28 Received: from drake.dyndns.org
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBFK4TMT025686
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sat, 15 Dec 2012 15:04:31 -0500 (EST)
\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
36 (envelope-from <amdragon@mit.edu>)
\r
37 id 1TjxyG-0007se-Py; Sat, 15 Dec 2012 15:04:28 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v2 6/7] emacs: Use unified error handling in search
\r
41 Date: Sat, 15 Dec 2012 15:04:19 -0500
\r
42 Message-Id: <1355601860-30121-7-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10.4
\r
44 In-Reply-To: <1355601860-30121-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1355601860-30121-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrXvp+pkAg5kbFC1Wz+WxuH5zJrPF
\r
48 m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlrP/KV/BesmLNjXnsDYzH
\r
49 RboYOTgkBEwkuj9odjFyApliEhfurWfrYuTiEBLYxyixcPNeKGcDo8T3T4eZIZxHTBI7dl1j
\r
50 hXDmMkqceH6RDaSfTUBDYtv+5YwgtoiAtMTOu7NZQWxmgTiJLVP+g8WFBZwlXr9oA4uzCKhK
\r
51 LFrQxQJi8wo4SLxYt5AN4g5Fie5nE8BsTgFHiYmTdzGB2EJANbcXzGGawMi/gJFhFaNsSm6V
\r
52 bm5iZk5xarJucXJiXl5qka65Xm5miV5qSukmRlBosbuo7GBsPqR0iFGAg1GJh3dHxOkAIdbE
\r
53 suLK3EOMkhxMSqK8GZfPBAjxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4U2aD5TjTUmsrEotyodJ
\r
54 SXOwKInzXk+56S8kkJ5YkpqdmlqQWgSTleHgUJLgnXoNqFGwKDU9tSItM6cEIc3EwQkynAdo
\r
55 eDdIDW9xQWJucWY6RP4Uo6KUOO9CkIQASCKjNA+uFxb7rxjFgV4R5t0CUsUDTBtw3a+ABjMB
\r
56 DV5uAza4JBEhJdXAaKQcz/1xr2CsRk/pxs1veHTYauz3+Bnfagn7HKp1IojtRRvj3nD9c7pC
\r
57 ugfOSfxKna77YsF38zL73Vvnck3IljAx33so69iq7LwNna+rJna++7d8/pHtnQ0dPxPtOzaw
\r
58 HIp4/GNi3pbzLR8rr/19uuN7R7Wn0K55M/+9m2GfmKNS9nzWiWSFnUosxRmJhlrMRcWJAFZq
\r
60 Cc: tomi.ollila@iki.fi
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Sat, 15 Dec 2012 20:04:38 -0000
\r
75 This slightly changes the output of an existing test since we now
\r
76 report non-zero exits with a pop-up buffer instead of at the end of
\r
79 emacs/notmuch-lib.el | 13 +++++++++++++
\r
80 emacs/notmuch.el | 13 ++++++++-----
\r
81 test/emacs-large-search-buffer | 2 +-
\r
82 3 files changed, 22 insertions(+), 6 deletions(-)
\r
84 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
85 index 7f7022a..8f84087 100644
\r
86 --- a/emacs/notmuch-lib.el
\r
87 +++ b/emacs/notmuch-lib.el
\r
88 @@ -334,6 +334,19 @@ the user dismisses it."
\r
90 (pop-to-buffer buf)))
\r
92 +(defun notmuch-check-async-exit-status (proc msg)
\r
93 + "If PROC exited abnormally, pop up an error buffer and signal an error.
\r
95 +This is a wrapper around `notmuch-check-exit-status' for
\r
96 +asynchronous process sentinels. PROC and MSG must be the
\r
97 +arguments passed to the sentinel."
\r
98 + (let ((exit-status
\r
99 + (case (process-status proc)
\r
100 + ((exit) (process-exit-status proc))
\r
101 + ((signal) msg))))
\r
102 + (when exit-status
\r
103 + (notmuch-check-exit-status exit-status (process-command proc)))))
\r
105 (defun notmuch-check-exit-status (exit-status command &optional output err-file)
\r
106 "If EXIT-STATUS is non-zero, pop up an error buffer and signal an error.
\r
108 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
109 index 9da8df4..b0fd387 100644
\r
110 --- a/emacs/notmuch.el
\r
111 +++ b/emacs/notmuch.el
\r
112 @@ -638,6 +638,7 @@ of the result."
\r
113 (exit-status (process-exit-status proc))
\r
114 (never-found-target-thread nil))
\r
115 (when (memq status '(exit signal))
\r
117 (kill-buffer (process-get proc 'parse-buf))
\r
118 (if (buffer-live-p buffer)
\r
119 (with-current-buffer buffer
\r
120 @@ -648,17 +649,19 @@ of the result."
\r
121 (if (eq status 'signal)
\r
122 (insert "Incomplete search results (search process was killed).\n"))
\r
123 (when (eq status 'exit)
\r
124 - (insert "End of search results.")
\r
125 - (unless (= exit-status 0)
\r
126 - (insert (format " (process returned %d)" exit-status)))
\r
128 + (insert "End of search results.\n")
\r
129 + (condition-case nil
\r
130 + (notmuch-check-async-exit-status proc msg)
\r
131 + ;; Suppress the error signal since strange
\r
132 + ;; things happen if a sentinel signals.
\r
133 + (error (throw 'return nil)))
\r
135 (not (string= notmuch-search-target-thread "found")))
\r
136 (set 'never-found-target-thread t)))))
\r
137 (when (and never-found-target-thread
\r
138 notmuch-search-target-line)
\r
139 (goto-char (point-min))
\r
140 - (forward-line (1- notmuch-search-target-line))))))))
\r
141 + (forward-line (1- notmuch-search-target-line)))))))))
\r
143 (defcustom notmuch-search-line-faces '(("unread" :weight bold)
\r
144 ("flagged" :foreground "blue"))
\r
145 diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-buffer
\r
146 index 678328d..9dcbef5 100755
\r
147 --- a/test/emacs-large-search-buffer
\r
148 +++ b/test/emacs-large-search-buffer
\r
149 @@ -36,7 +36,7 @@ test_emacs '(notmuch-search "--this-option-does-not-exist")
\r
150 cat <<EOF >EXPECTED
\r
151 Error: Unexpected output from notmuch search:
\r
152 Unrecognized option: --this-option-does-not-exist
\r
153 -End of search results. (process returned 1)
\r
154 +End of search results.
\r
156 test_expect_equal_file OUTPUT EXPECTED
\r