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

diff --git a/c1/e3074eeb28b907622fdec1f45f7fc6346ffd16 b/c1/e3074eeb28b907622fdec1f45f7fc6346ffd16
new file mode 100644 (file)
index 0000000..b4a7fbb
--- /dev/null
@@ -0,0 +1,116 @@
+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 E4DBD431FC0\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:34 -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 54otia3fd5XB for <notmuch@notmuchmail.org>;\r
+       Sat, 15 Dec 2012 12:04:34 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id CF3AE431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:33 -0800 (PST)\r
+X-AuditID: 1209190e-b7f516d0000008e4-e5-50ccd7d1e208\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 9E.06.02276.1D7DCC05; Sat, 15 Dec 2012 15:04:33 -0500 (EST)\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 qBFK4W5Q014181; \r
+       Sat, 15 Dec 2012 15:04:32 -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 qBFK4SQZ025682\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 15 Dec 2012 15:04:31 -0500 (EST)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TjxyG-0007sT-Jq; Sat, 15 Dec 2012 15:04:28 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 2/7] emacs: Use unified error handling in\r
+       notmuch-call-notmuch-process\r
+Date: Sat, 15 Dec 2012 15:04:15 -0500\r
+Message-Id: <1355601860-30121-3-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1355601860-30121-1-git-send-email-amdragon@mit.edu>\r
+References: <1355601860-30121-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrHvx+pkAg1UfpCxWz+WxuH5zJrPF\r
+       m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlrLz3k6ngAE/Fod55bA2M\r
+       c7i6GDk5JARMJP4cOcMOYYtJXLi3nq2LkYtDSGAfo8SOs53MIAkhgQ2MEk/nGkEkHjFJrOr4\r
+       yAjhzGWU6L0yHayKTUBDYtv+5YwgtoiAtMTOu7NZQWxmgTiJLVP+g8WFBSIlDm+7CWazCKhK\r
+       LNyxmA3E5hVwkFi48hnUGYoS3c8mgMU5BRwlJk7exQRxhYPE7QVzmCYw8i9gZFjFKJuSW6Wb\r
+       m5iZU5yarFucnJiXl1qka6yXm1mil5pSuokRHFySfDsYvx5UOsQowMGoxMO7I+J0gBBrYllx\r
+       Ze4hRkkOJiVR3ozLZwKE+JLyUyozEosz4otKc1KLDzFKcDArifAmzQfK8aYkVlalFuXDpKQ5\r
+       WJTEea+k3PQXEkhPLEnNTk0tSC2CycpwcChJ8AoBo0hIsCg1PbUiLTOnBCHNxMEJMpwHaDgH\r
+       SA1vcUFibnFmOkT+FKOilDivHUhCACSRUZoH1wuL/leM4kCvCPN+uAZUxQNMHHDdr4AGMwEN\r
+       Xm4DNrgkESEl1cAYcHzTS8dfa6wNHq/5x/Lg4gP+ta8sAmdbGtR9Z+T8mu238n2C4IbuQ2tn\r
+       ffRPudfRanNpvaKH8hLWov/B27XUw+9cjfIqT+O5eO3Vk17jWB++3KdWr3y/vTzR7C6lJJMX\r
+       vP5odEbC3Sn+VpsaLGf8PvDdYod7qka2qoSVlGtWG++ps1eEvu9UYinOSDTUYi4qTgQA24gY\r
+       4dkCAAA=\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: Sat, 15 Dec 2012 20:04:35 -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 |   20 +++++++-------------\r
+ 1 file changed, 7 insertions(+), 13 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index f9454d8..9da8df4 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -536,19 +536,13 @@ If BARE is set then do not prefix with \"thread:\""\r
+ (defun notmuch-call-notmuch-process (&rest args)\r
+   "Synchronously invoke \"notmuch\" with the given list of arguments.\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
++If notmuch exits with a non-zero status, output from the process\r
++will appear in a buffer named \"*Notmuch errors*\" and an error\r
++will be signaled."\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