From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1055A431FD2 for ; Thu, 5 Jul 2012 13:52:46 -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 U3FugbHiEpfr for ; Thu, 5 Jul 2012 13:52:45 -0700 (PDT) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id 75B7E431FC2 for ; Thu, 5 Jul 2012 13:52:43 -0700 (PDT) X-AuditID: 1209190e-b7fb56d0000008b2-3b-4ff5fe9b6692 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id CB.2A.02226.B9EF5FF4; Thu, 5 Jul 2012 16:52:43 -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 q65KqgQN026897; Thu, 5 Jul 2012 16:52:42 -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 q65KqbOZ027236 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Thu, 5 Jul 2012 16:52:40 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1Smt2T-0004XZ-I6; Thu, 05 Jul 2012 16:52:37 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2 3/9] emacs: Helper for reporting search parsing errors Date: Thu, 5 Jul 2012 16:52:21 -0400 Message-Id: <1341521547-15502-4-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341521547-15502-1-git-send-email-amdragon@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> <1341521547-15502-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nojv731d/gy1XhCxWz+WxuH5zJrPF m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlTHx+hrlgJk/Fv2WLmBsY 33B2MXJySAiYSOzftYAVwhaTuHBvPVsXIxeHkMA+Rok1y7czQzjrGSUeXDsJlTnJJPF/2WUW CGcuo8T6hy/YQPrZBDQktu1fzghiiwhIS+y8OxtsLrNAnMSWKf/B4sICnhJrnyxjBrFZBFQl nu/6AWbzCjhITH33jxniDnmJp/f7wGZyCjhKXJi4GKxXSKBc4s+SfywTGPkXMDKsYpRNya3S zU3MzClOTdYtTk7My0st0jXWy80s0UtNKd3ECAovTkm+HYxfDyodYhTgYFTi4TXO/eIvxJpY VlyZe4hRkoNJSZS38fdXfyG+pPyUyozE4oz4otKc1OJDjBIczEoivL0ZQDnelMTKqtSifJiU NAeLkjjvlZSb/kIC6YklqdmpqQWpRTBZGQ4OJQnelX+BGgWLUtNTK9Iyc0oQ0kwcnCDDeYCG rwWp4S0uSMwtzkyHyJ9iVJQS550JkhAASWSU5sH1wuL/FaM40CvCvJ9AqniAqQOu+xXQYCag wXmLP4EMLklESEk1MM4zuXVx+n7vx55CKVufn1561HG723uH6Qfu5H/3YY1fkPyzOHHPASXZ Y6xn3l58pSUlVftVYrWv3UzPVLOKTKFcX9PpAsdddKsqdi78sV/wde9d3x7vLwvzszqf/rLe FOZWyNtZzOArkCpRbsDL7l//deoMPf6s6fcb7POj/p+9/Mim+uG560osxRmJhlrMRcWJAHBQ DMLaAgAA 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: Thu, 05 Jul 2012 20:52:46 -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