--- /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 363B5431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 3 Jul 2012 15:21:11 -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 IqHR9Nfr+O21 for <notmuch@notmuchmail.org>;\r
+ Tue, 3 Jul 2012 15:21:07 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+ [18.7.68.36])\r
+ by olra.theworths.org (Postfix) with ESMTP id 6CB00431FC0\r
+ for <notmuch@notmuchmail.org>; Tue, 3 Jul 2012 15:21:06 -0700 (PDT)\r
+X-AuditID: 12074424-b7f2a6d0000008bf-50-4ff370518b17\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 4B.F6.02239.15073FF4; Tue, 3 Jul 2012 18:21:05 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q63ML4mu022243; \r
+ Tue, 3 Jul 2012 18:21:05 -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.6/8.12.4) with ESMTP id q63ML1vx023222\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Tue, 3 Jul 2012 18:21:02 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1SmBSv-0007fS-0y; Tue, 03 Jul 2012 18:21:01 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/8] emacs: Helper for reporting search parsing errors\r
+Date: Tue, 3 Jul 2012 18:20:55 -0400\r
+Message-Id: <1341354059-29396-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
+References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFrrAIsWRmVeSWpSXmKPExsUixG6nohtY8NnfYNpLQ4sje2axWyw985/Z\r
+ 4vrNmcwWb1bOY3Vg8dg56y67x+GvC1k8nq26xezR9GMxawBLFJdNSmpOZllqkb5dAlfGzqX/\r
+ WAo6eSr6zk9mbGC8yNnFyMkhIWAiceXIFhYIW0ziwr31bF2MXBxCAvsYJc7dbWYDSQgJrGeU\r
+ aN0rCJE4ySQx4c8hRghnLqPE3G2vWEGq2AQ0JLbtX84IYosISEvsvDsbLM4skCtxtvUwWFxY\r
+ wE3i3uU9TCA2i4CqxMre3UCrOTh4BRwkNnf4QFwhL/H0fh/YYk4BR4kVN8+yQBzhILHtQwfr\r
+ BEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3TN9XIzS/RSU0o3MYIDzkVlB2PzIaVDjAIc\r
+ jEo8vIkKn/2FWBPLiitzDzFKcjApifJeyQMK8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuFdnQSU\r
+ 401JrKxKLcqHSUlzsCiJ815PuekvJJCeWJKanZpakFoEk5Xh4FCS4GUARpaQYFFqempFWmZO\r
+ CUKaiYMTZDgP0PBl+SDDiwsSc4sz0yHypxgVpcR5d4IkBEASGaV5cL2whPCKURzoFWFeRpAV\r
+ PMBkAtf9CmgwE9DgvMWfQAaXJCKkpBoYF8r5inRuWmP5+r+XyCN7tm3vHiub6BQKuP0vVl3S\r
+ ImJyS3XWNMfzNobe6mHrEoJntz3l8d1WKPVfzetyWlXhzvJDv/yP96cnf2Uqjp9iqpH+W/fE\r
+ AXfnXrYT4fUsHubREt6y4k/lRWZK6PUEn+0yaNsz4W2Ro5DH2zux73/r3v7hLrHVj0OJpTgj\r
+ 0VCLuag4EQASv9HR4wIAAA==\r
+Cc: tomi.ollila@iki.fi\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: Tue, 03 Jul 2012 22:21:11 -0000\r
+\r
+This removes the last bit of direct output from the parsing function.\r
+With the parser now responsible solely for parsing, we can swap it out\r
+for another parser.\r
+---\r
+ emacs/notmuch.el | 10 +++++++++-\r
+ 1 file changed, 9 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 4a6490a..a073367 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -745,6 +745,13 @@ non-authors is found, assume that all of the authors match."\r
+ (setq notmuch-search-target-thread "found")\r
+ (goto-char beg)))))\r
+ \r
++(defun notmuch-search-show-error (string &rest objects)\r
++ (save-excursion\r
++ (goto-char (point-max))\r
++ (insert "Error: Unexpected output from notmuch search:\n")\r
++ (insert (apply #'format string objects))\r
++ (insert "\n")))\r
++\r
+ (defun notmuch-search-process-filter (proc string)\r
+ "Process and filter the output of \"notmuch search\""\r
+ (let ((buffer (process-buffer proc)))\r
+@@ -767,7 +774,8 @@ non-authors is found, assume that all of the authors match."\r
+ (tags (match-string 6 string))\r
+ (tag-list (if tags (save-match-data (split-string tags)))))\r
+ (if (/= (match-beginning 1) line)\r
+- (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))\r
++ (notmuch-search-show-error\r
++ (substring string line (match-beginning 1))))\r
+ (notmuch-search-show-result thread-id date count authors subject tag-list)\r
+ (set 'line (match-end 0)))\r
+ (set 'more nil)\r
+-- \r
+1.7.10\r
+\r