[PATCH 2/7] emacs: Use unified error handling in notmuch-call-notmuch-process
authorAustin Clements <amdragon@MIT.EDU>
Sat, 15 Dec 2012 05:15:08 +0000 (00:15 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:12 +0000 (09:52 -0800)
78/07a31aa4843d58d0ff6ae7a576f9e001142734 [new file with mode: 0644]

diff --git a/78/07a31aa4843d58d0ff6ae7a576f9e001142734 b/78/07a31aa4843d58d0ff6ae7a576f9e001142734
new file mode 100644 (file)
index 0000000..a726d81
--- /dev/null
@@ -0,0 +1,109 @@
+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 EFA22431FC9\r
+       for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 21:15:57 -0800 (PST)\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 HSIMEeuTUFfF for <notmuch@notmuchmail.org>;\r
+       Fri, 14 Dec 2012 21:15:56 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
+       [18.9.25.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id AC912429E3D\r
+       for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 21:15:37 -0800 (PST)\r
+X-AuditID: 1209190c-b7f886d000000936-8c-50cc0779934b\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 93.02.02358.9770CC05; Sat, 15 Dec 2012 00:15:37 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qBF5FQdH020493; \r
+       Sat, 15 Dec 2012 00:15:26 -0500\r
+Received: from drake.dyndns.org\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (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 qBF5FOPB011444\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 15 Dec 2012 00:15:25 -0500 (EST)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Tjk5s-0002kL-58; Sat, 15 Dec 2012 00:15:24 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/7] emacs: Use unified error handling in\r
+       notmuch-call-notmuch-process\r
+Date: Sat, 15 Dec 2012 00:15:08 -0500\r
+Message-Id: <1355548513-10085-3-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1355548513-10085-1-git-send-email-amdragon@mit.edu>\r
+References: <1355548513-10085-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixG6nrlvJfibAoPmfkMXquTwW12/OZHZg\r
+       8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mq6fWMZYsIyr4tf6KUwNjOs5uhg5OSQETCRW\r
+       t6xlhbDFJC7cW8/WxcjFISSwj1HiwJqjUM4GRokthy9DOY+YJP7c/coO4cxllDi56itYP5uA\r
+       hsS2/csZQWwRAWmJnXdng8WZBRwlPu9fxAZiCwuESdx69IcZxGYRUJV4/rkLLM4r4CAx5/k+\r
+       qDsUJbqfTQCLcwL1Lvt4jgXEFgKqOfvqLusERv4FjAyrGGVTcqt0cxMzc4pTk3WLkxPz8lKL\r
+       dA31cjNL9FJTSjcxgkKJU5JnB+Obg0qHGAU4GJV4eHdEnA4QYk0sK67MPcQoycGkJMp7i+FM\r
+       gBBfUn5KZUZicUZ8UWlOavEhRgkOZiURXrEtQOW8KYmVValF+TApaQ4WJXHeyyk3/YUE0hNL\r
+       UrNTUwtSi2CyMhwcShK8P9iAhgoWpaanVqRl5pQgpJk4OEGG8wANB6vhLS5IzC3OTIfIn2JU\r
+       lBLnvQqSEABJZJTmwfXCYv0VozjQK8K80SBVPMA0Adf9CmgwE9DguEvHQQaXJCKkpBoY9S5I\r
+       NWwof/r5w9Ud8lo/X4c9exvk7bb9e5fnf44jDNGhK49XL/e1/nAhuGWl/jnWnb9OTrnhOjfv\r
+       WITpu7wfxVvepDwX/qFstUHvVf8mfqmX/5cxqJ+JPHsrcP36tMeRet4tXYuyD61YlffR7/L8\r
+       G9Er7nZcXZQnmcT74+dpjuU5Ykdt/jz52qfEUpyRaKjFXFScCABdaiRT0AIAAA==\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: Sat, 15 Dec 2012 05:15:58 -0000\r
+\r
+This makes notmuch-call-notmuch-process use the unified CLI error\r
+handling, which basically refines the error handling this function\r
+already did.\r
+---\r
+ emacs/notmuch.el |   15 ++++-----------\r
+ 1 file changed, 4 insertions(+), 11 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index f9454d8..e25b54e 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -538,17 +538,10 @@ If BARE is set then do not prefix with \"thread:\""\r
\r
+ Output from the process will be presented to the user as an error\r
+ and will also appear in a buffer named \"*Notmuch errors*\"."\r
+-  (let ((error-buffer (get-buffer-create "*Notmuch errors*")))\r
+-    (with-current-buffer error-buffer\r
+-      (erase-buffer))\r
+-    (if (eq (apply 'call-process notmuch-command nil error-buffer nil args) 0)\r
+-      (point)\r
+-      (progn\r
+-      (with-current-buffer error-buffer\r
+-        (let ((beg (point-min))\r
+-              (end (- (point-max) 1)))\r
+-          (error (buffer-substring beg end))\r
+-          ))))))\r
++  (with-temp-buffer\r
++    (let ((status (apply #'call-process notmuch-command nil t nil args)))\r
++      (notmuch-check-exit-status status (cons notmuch-command args)\r
++                               (buffer-string)))))\r
\r
+ (defun notmuch-search-set-tags (tags &optional pos)\r
+   (let ((new-result (plist-put (notmuch-search-get-result pos) :tags tags)))\r
+-- \r
+1.7.10.4\r
+\r