[PATCH v3 3/9] emacs: Helper for reporting search parsing errors
authorAustin Clements <amdragon@MIT.EDU>
Mon, 9 Jul 2012 21:42:36 +0000 (17:42 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:05 +0000 (09:48 -0800)
ef/5a134c212b6becb267393b96ef3059bfc620aa [new file with mode: 0644]

diff --git a/ef/5a134c212b6becb267393b96ef3059bfc620aa b/ef/5a134c212b6becb267393b96ef3059bfc620aa
new file mode 100644 (file)
index 0000000..b056f85
--- /dev/null
@@ -0,0 +1,110 @@
+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 E12FA429E34\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 14:42:51 -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 9GNWJ6Vl6Rh7 for <notmuch@notmuchmail.org>;\r
+       Mon,  9 Jul 2012 14:42:51 -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 0E7BE429E2F\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 14:42:49 -0700 (PDT)\r
+X-AuditID: 12074422-b7f1f6d00000090b-4e-4ffb5058c38e\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 95.39.02315.8505BFF4; Mon,  9 Jul 2012 17:42:48 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q69LgljQ011260; \r
+       Mon, 9 Jul 2012 17:42:47 -0400\r
+Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176])\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 q69LgiSH022684\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 9 Jul 2012 17:42:45 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SoLjA-0004fu-0N; Mon, 09 Jul 2012 17:42:44 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 3/9] emacs: Helper for reporting search parsing errors\r
+Date: Mon,  9 Jul 2012 17:42:36 -0400\r
+Message-Id: <1341870162-17782-4-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu>\r
+References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
+       <1341870162-17782-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrBsR8NvfoPegpsXquTwW12/OZLZ4\r
+       s3IeqwOzx85Zd9k9Dn9dyOLxbNUt5gDmKC6blNSczLLUIn27BK6Mic/PMBfM5Kn4t2wRcwPj\r
+       G84uRg4OCQETiaeTpLoYOYFMMYkL99azdTFycQgJ7GOUOPnkJhOEs55Ron3lbyjnJJPEhsXX\r
+       oJy5jBKz7vxkBulnE9CQ2LZ/OSOILSIgLbHz7mxWEJtZIE5iy5T/jCDrhAU8Jfp+lYOEWQRU\r
+       JTb9f8IEYvMKOEh8OdHCAnGGvMTT+31sIDangKPEnJs7wEYKCZRLfL7xj3kCI/8CRoZVjLIp\r
+       uVW6uYmZOcWpybrFyYl5ealFuqZ6uZkleqkppZsYQaHF7qK0g/HnQaVDjAIcjEo8vJtYfvsL\r
+       sSaWFVfmHmKU5GBSEuXN8wQK8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuG95QqU401JrKxKLcqH\r
+       SUlzsCiJ815LuekvJJCeWJKanZpakFoEk5Xh4FCS4J3mD9QoWJSanlqRlplTgpBm4uAEGc4D\r
+       NPwcSA1vcUFibnFmOkT+FKOilDjvdZCEAEgiozQPrhcW+68YxYFeEebdAVLFA0wbcN2vgAYz\r
+       AQ1u7/kFMrgkESEl1cDYYNzHfV/zuGCt7+wLRntU9wvfmMJ80lfQmb9gxuPqNyHh+lrewosZ\r
+       S+7uigisaZ+cf3eleQcra36uiGDOw+OWRdcZOf5/iLFnulK5m2vGl1lyNlPMBVhNLhlFTd8b\r
+       LqA59/uRAibP49IZG6dFBYb/XnREKpctoi6vJU87d7pC0umds8tlJyqxFGckGmoxFxUnAgDK\r
+       kNBe2AIAAA==\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: Mon, 09 Jul 2012 21:42:52 -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 |    8 +++++++-\r
+ 1 file changed, 7 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 746d0cb..f952fa8 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -741,6 +741,11 @@ non-authors is found, assume that all of the authors match."\r
+       (put-text-property beg (point) 'notmuch-search-authors authors)\r
+       (put-text-property beg (point) 'notmuch-search-subject subject))))\r
\r
++(defun notmuch-search-show-error (string &rest objects)\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
+@@ -766,7 +771,8 @@ non-authors is found, assume that all of the authors match."\r
+                          (tag-list (if tags (save-match-data (split-string tags)))))\r
+                     (goto-char (point-max))\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
+                     (when (string= thread-id notmuch-search-target-thread)\r
+                       (set 'found-target (point))\r
+                       (set 'notmuch-search-target-thread "found"))\r
+-- \r
+1.7.10\r
+\r