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