From 5c52489ee499a8cb576720b2b465067bb721b53e Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 10 Jul 2012 17:42:36 +2000 Subject: [PATCH] [PATCH v3 3/9] emacs: Helper for reporting search parsing errors --- ef/5a134c212b6becb267393b96ef3059bfc620aa | 110 ++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 ef/5a134c212b6becb267393b96ef3059bfc620aa diff --git a/ef/5a134c212b6becb267393b96ef3059bfc620aa b/ef/5a134c212b6becb267393b96ef3059bfc620aa new file mode 100644 index 000000000..b056f8523 --- /dev/null +++ b/ef/5a134c212b6becb267393b96ef3059bfc620aa @@ -0,0 +1,110 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id E12FA429E34 + for ; Mon, 9 Jul 2012 14:42:51 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 9GNWJ6Vl6Rh7 for ; + Mon, 9 Jul 2012 14:42:51 -0700 (PDT) +Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU + [18.7.68.34]) + by olra.theworths.org (Postfix) with ESMTP id 0E7BE429E2F + for ; Mon, 9 Jul 2012 14:42:49 -0700 (PDT) +X-AuditID: 12074422-b7f1f6d00000090b-4e-4ffb5058c38e +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP + id 95.39.02315.8505BFF4; Mon, 9 Jul 2012 17:42:48 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q69LgljQ011260; + Mon, 9 Jul 2012 17:42:47 -0400 +Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q69LgiSH022684 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 9 Jul 2012 17:42:45 -0400 (EDT) +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1SoLjA-0004fu-0N; Mon, 09 Jul 2012 17:42:44 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH v3 3/9] emacs: Helper for reporting search parsing errors +Date: Mon, 9 Jul 2012 17:42:36 -0400 +Message-Id: <1341870162-17782-4-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu> +References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> + <1341870162-17782-1-git-send-email-amdragon@mit.edu> +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrBsR8NvfoPegpsXquTwW12/OZLZ4 + s3IeqwOzx85Zd9k9Dn9dyOLxbNUt5gDmKC6blNSczLLUIn27BK6Mic/PMBfM5Kn4t2wRcwPj + G84uRg4OCQETiaeTpLoYOYFMMYkL99azdTFycQgJ7GOUOPnkJhOEs55Ron3lbyjnJJPEhsXX + oJy5jBKz7vxkBulnE9CQ2LZ/OSOILSIgLbHz7mxWEJtZIE5iy5T/jCDrhAU8Jfp+lYOEWQRU + JTb9f8IEYvMKOEh8OdHCAnGGvMTT+31sIDangKPEnJs7wEYKCZRLfL7xj3kCI/8CRoZVjLIp + uVW6uYmZOcWpybrFyYl5ealFuqZ6uZkleqkppZsYQaHF7qK0g/HnQaVDjAIcjEo8vJtYfvsL + sSaWFVfmHmKU5GBSEuXN8wQK8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuG95QqU401JrKxKLcqH + SUlzsCiJ815LuekvJJCeWJKanZpakFoEk5Xh4FCS4J3mD9QoWJSanlqRlplTgpBm4uAEGc4D + NPwcSA1vcUFibnFmOkT+FKOilDjvdZCEAEgiozQPrhcW+68YxYFeEebdAVLFA0wbcN2vgAYz + AQ1u7/kFMrgkESEl1cDYYNzHfV/zuGCt7+wLRntU9wvfmMJ80lfQmb9gxuPqNyHh+lrewosZ + S+7uigisaZ+cf3eleQcra36uiGDOw+OWRdcZOf5/iLFnulK5m2vGl1lyNlPMBVhNLhlFTd8b + LqA59/uRAibP49IZG6dFBYb/XnREKpctoi6vJU87d7pC0umds8tlJyqxFGckGmoxFxUnAgDK + kNBe2AIAAA== +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 09 Jul 2012 21:42:52 -0000 + +This removes the last bit of direct output from the parsing function. +With the parser now responsible solely for parsing, we can swap it out +for another parser. +--- + emacs/notmuch.el | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 746d0cb..f952fa8 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -741,6 +741,11 @@ non-authors is found, assume that all of the authors match." + (put-text-property beg (point) 'notmuch-search-authors authors) + (put-text-property beg (point) 'notmuch-search-subject subject)))) + ++(defun notmuch-search-show-error (string &rest objects) ++ (insert "Error: Unexpected output from notmuch search:\n") ++ (insert (apply #'format string objects)) ++ (insert "\n")) ++ + (defun notmuch-search-process-filter (proc string) + "Process and filter the output of \"notmuch search\"" + (let ((buffer (process-buffer proc)) +@@ -766,7 +771,8 @@ non-authors is found, assume that all of the authors match." + (tag-list (if tags (save-match-data (split-string tags))))) + (goto-char (point-max)) + (if (/= (match-beginning 1) line) +- (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n"))) ++ (notmuch-search-show-error ++ (substring string line (match-beginning 1)))) + (when (string= thread-id notmuch-search-target-thread) + (set 'found-target (point)) + (set 'notmuch-search-target-thread "found")) +-- +1.7.10 + -- 2.26.2