[PATCH v3 06/10] cli: Introduce "notmuch address" command
[notmuch-archives.git] / 27 / dc7d92faf8b67fc3d60408b6780c74314b1999
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 DFBEE431FC2\r
6         for <notmuch@notmuchmail.org>; Fri, 17 May 2013 13:14:16 -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: -0.7\r
10 X-Spam-Level: \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 hSZmrlPSBoiC for <notmuch@notmuchmail.org>;\r
16         Fri, 17 May 2013 13:14:11 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 4E05D431FC9\r
20         for <notmuch@notmuchmail.org>; Fri, 17 May 2013 13:14:11 -0700 (PDT)\r
21 X-AuditID: 12074422-b7f5b6d00000095d-5d-51968f90d952\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 7A.19.02397.09F86915; Fri, 17 May 2013 16:14:08 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r4HKE7qJ013932; \r
27         Fri, 17 May 2013 16:14:07 -0400\r
28 Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\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 r4HKE54o004606\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 17 May 2013 16:14:06 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1UdR2T-0006Jx-NV; Fri, 17 May 2013 16:14:05 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH] emacs: Fix trimming regexp in notmuch-check-exit-status\r
40 Date: Fri, 17 May 2013 16:14:03 -0400\r
41 Message-Id: <1368821643-24179-1-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 X-Brightmail-Tracker:\r
44  H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsUixCmqrTuhf1qgwfGjmhbXb85kdmD0eLbq\r
45         FnMAYxSXTUpqTmZZapG+XQJXxtGFPcwFc/krtt85y9rAOImni5GTQ0LAROLKo++MELaYxIV7\r
46         69lAbCGBfYwSx5a6djFyAdkbGSX2PfvFBOEcYZK4teMeVNVcRolnTyRAbDYBDYlt+5eDTRIR\r
47         kJbYeXc2axcjBwezgJrEny4VEFNYwEPi/HlFEJNFQFVi3sxwkGJeAQeJY+cfskCcoCjR/WwC\r
48         2wRG3gWMDKsYZVNyq3RzEzNzilOTdYuTE/PyUot0TfVyM0v0UlNKNzGC/M/uorSD8edBpUOM\r
49         AhyMSjy8M5ynBQqxJpYVV+YeYpTkYFIS5XXoBgrxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4X1e\r
50         DJTjTUmsrEotyodJSXOwKInzXku56S8kkJ5YkpqdmlqQWgSTleHgUJLgFQSGuZBgUWp6akVa\r
51         Zk4JQpqJgxNkOA/QcNE+kOHFBYm5xZnpEPlTjLocm89PfscoxJKXn5cqJc6rAzJIAKQoozQP\r
52         bg4sbl8xigO9JcwrAFLFA4x5uEmvgJYwAS1hvTYVZElJIkJKqoExcX+2bYODw9kjf7TYlTf2\r
53         Ttv3mX+d0K7iec7Hrt7/tHph7KmkzasaZygbi+jVFVh8Uf0/+XTLtx1RvL05LY9WrDa10vv+\r
54         Q60meUZ497SdUe8DpErjD1jkTvrXLCf/WPXv7m133ibcvygZfMrlZuaz6twbvErmuysy+/v9\r
55         9Sblr5z3YI4hz+49SizFGYmGWsxFxYkAQZ3PirYCAAA=\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Fri, 17 May 2013 20:14:17 -0000\r
69 \r
70 For such a simple regexp, this was broken in a very complicated way.\r
71 \r
72 The intent was to strip the newline (and potentially other whitespace)\r
73 off the end of the error string so there wasn't an extra newline in\r
74 the error signal.  However, the regexp was deeply dependent on the\r
75 active syntax table and the subtleties of $.  We didn't notice this\r
76 because all notmuch major modes put ?\n in the whitespace class, which\r
77 makes this behaved as intended: the "\\s " matches all newlines, but\r
78 by matching the newline character, causes the $ *not* to match\r
79 *except* where it matched the empty string at the very end of the\r
80 string, which was not followed by a newline.\r
81 \r
82 However, if the syntax table declares ?\n to be non-whitespace\r
83 (lisp-mode declares it as endcomment, and is likely to be the mode\r
84 you're in when testing functions), then this regexp behaves completely\r
85 differently, matching trailing spaces at the end of every line within\r
86 the string.\r
87 \r
88 The solution is to say what we mean for whitespace *and* to switch\r
89 from $ to \', which matches only the end of the string, rather than\r
90 the end of each line.  Both are necessary or this will strip away\r
91 interior newlines, which is not what we want.\r
92 ---\r
93  emacs/notmuch-lib.el |    2 +-\r
94  1 file changed, 1 insertion(+), 1 deletion(-)\r
95 \r
96 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
97 index 790136e..59b1ce3 100644\r
98 --- a/emacs/notmuch-lib.el\r
99 +++ b/emacs/notmuch-lib.el\r
100 @@ -438,7 +438,7 @@ You may need to restart Emacs or upgrade your notmuch package."))\r
101         (if err\r
102             ;; We have an error message straight from the CLI.\r
103             (notmuch-logged-error\r
104 -            (replace-regexp-in-string "\\s $" "" err) extra)\r
105 +            (replace-regexp-in-string "[ \n\r\t\f]*\\'" "" err) extra)\r
106           ;; We only have combined output from the CLI; don't inundate\r
107           ;; the user with it.  Mimic `process-lines'.\r
108           (notmuch-logged-error (format "%s exited with status %s"\r
109 -- \r
110 1.7.10.4\r
111 \r