--- /dev/null
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id DFBEE431FC2\r
+ for <notmuch@notmuchmail.org>; Fri, 17 May 2013 13:14:16 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id hSZmrlPSBoiC for <notmuch@notmuchmail.org>;\r
+ Fri, 17 May 2013 13:14:11 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4E05D431FC9\r
+ for <notmuch@notmuchmail.org>; Fri, 17 May 2013 13:14:11 -0700 (PDT)\r
+X-AuditID: 12074422-b7f5b6d00000095d-5d-51968f90d952\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 7A.19.02397.09F86915; Fri, 17 May 2013 16:14:08 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r4HKE7qJ013932; \r
+ Fri, 17 May 2013 16:14:07 -0400\r
+Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r4HKE54o004606\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Fri, 17 May 2013 16:14:06 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1UdR2T-0006Jx-NV; Fri, 17 May 2013 16:14:05 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Fix trimming regexp in notmuch-check-exit-status\r
+Date: Fri, 17 May 2013 16:14:03 -0400\r
+Message-Id: <1368821643-24179-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrMIsWRmVeSWpSXmKPExsUixCmqrTuhf1qgwfGjmhbXb85kdmD0eLbq\r
+ FnMAYxSXTUpqTmZZapG+XQJXxtGFPcwFc/krtt85y9rAOImni5GTQ0LAROLKo++MELaYxIV7\r
+ 69lAbCGBfYwSx5a6djFyAdkbGSX2PfvFBOEcYZK4teMeVNVcRolnTyRAbDYBDYlt+5eDTRIR\r
+ kJbYeXc2axcjBwezgJrEny4VEFNYwEPi/HlFEJNFQFVi3sxwkGJeAQeJY+cfskCcoCjR/WwC\r
+ 2wRG3gWMDKsYZVNyq3RzEzNzilOTdYuTE/PyUot0TfVyM0v0UlNKNzGC/M/uorSD8edBpUOM\r
+ AhyMSjy8M5ynBQqxJpYVV+YeYpTkYFIS5XXoBgrxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4X1e\r
+ DJTjTUmsrEotyodJSXOwKInzXku56S8kkJ5YkpqdmlqQWgSTleHgUJLgFQSGuZBgUWp6akVa\r
+ Zk4JQpqJgxNkOA/QcNE+kOHFBYm5xZnpEPlTjLocm89PfscoxJKXn5cqJc6rAzJIAKQoozQP\r
+ bg4sbl8xigO9JcwrAFLFA4x5uEmvgJYwAS1hvTYVZElJIkJKqoExcX+2bYODw9kjf7TYlTf2\r
+ Ttv3mX+d0K7iec7Hrt7/tHph7KmkzasaZygbi+jVFVh8Uf0/+XTLtx1RvL05LY9WrDa10vv+\r
+ Q60meUZ497SdUe8DpErjD1jkTvrXLCf/WPXv7m133ibcvygZfMrlZuaz6twbvErmuysy+/v9\r
+ 9Sblr5z3YI4hz+49SizFGYmGWsxFxYkAQZ3PirYCAAA=\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 17 May 2013 20:14:17 -0000\r
+\r
+For such a simple regexp, this was broken in a very complicated way.\r
+\r
+The intent was to strip the newline (and potentially other whitespace)\r
+off the end of the error string so there wasn't an extra newline in\r
+the error signal. However, the regexp was deeply dependent on the\r
+active syntax table and the subtleties of $. We didn't notice this\r
+because all notmuch major modes put ?\n in the whitespace class, which\r
+makes this behaved as intended: the "\\s " matches all newlines, but\r
+by matching the newline character, causes the $ *not* to match\r
+*except* where it matched the empty string at the very end of the\r
+string, which was not followed by a newline.\r
+\r
+However, if the syntax table declares ?\n to be non-whitespace\r
+(lisp-mode declares it as endcomment, and is likely to be the mode\r
+you're in when testing functions), then this regexp behaves completely\r
+differently, matching trailing spaces at the end of every line within\r
+the string.\r
+\r
+The solution is to say what we mean for whitespace *and* to switch\r
+from $ to \', which matches only the end of the string, rather than\r
+the end of each line. Both are necessary or this will strip away\r
+interior newlines, which is not what we want.\r
+---\r
+ emacs/notmuch-lib.el | 2 +-\r
+ 1 file changed, 1 insertion(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 790136e..59b1ce3 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -438,7 +438,7 @@ You may need to restart Emacs or upgrade your notmuch package."))\r
+ (if err\r
+ ;; We have an error message straight from the CLI.\r
+ (notmuch-logged-error\r
+- (replace-regexp-in-string "\\s $" "" err) extra)\r
++ (replace-regexp-in-string "[ \n\r\t\f]*\\'" "" err) extra)\r
+ ;; We only have combined output from the CLI; don't inundate\r
+ ;; the user with it. Mimic `process-lines'.\r
+ (notmuch-logged-error (format "%s exited with status %s"\r
+-- \r
+1.7.10.4\r
+\r