[PATCH v2 0/7] Improve Emacs CLI error handling
authorAustin Clements <amdragon@MIT.EDU>
Sat, 15 Dec 2012 20:04:13 +0000 (15:04 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:19 +0000 (09:52 -0800)
04/594f14f56fc34fa184d9718a5d359529749bfd [new file with mode: 0644]

diff --git a/04/594f14f56fc34fa184d9718a5d359529749bfd b/04/594f14f56fc34fa184d9718a5d359529749bfd
new file mode 100644 (file)
index 0000000..f62f8f9
--- /dev/null
@@ -0,0 +1,147 @@
+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 14BAA431FC7\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:36 -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 Zxfbhc3euh5q for <notmuch@notmuchmail.org>;\r
+       Sat, 15 Dec 2012 12:04:35 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
+       [18.9.25.13])\r
+       by olra.theworths.org (Postfix) with ESMTP id B24A4431FC2\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 12:04:34 -0800 (PST)\r
+X-AuditID: 1209190d-b7f266d00000092b-81-50ccd7d1c647\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id BD.DB.02347.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-3.mit.edu (8.13.8/8.9.2) with ESMTP id qBFK4WQG022933; \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 qBFK4SYq025680\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-0007sP-Gd; Sat, 15 Dec 2012 15:04:28 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 0/7] Improve Emacs CLI error handling\r
+Date: Sat, 15 Dec 2012 15:04:13 -0500\r
+Message-Id: <1355601860-30121-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsUixCmqrXvx+pkAg3ddMhar5/JYXL85k9ni\r
+       zcp5rA7MHjtn3WX3OPx1IYvHs1W3mAOYo7hsUlJzMstSi/TtErgydvU8YyrYK16x7sQB5gbG\r
+       XuEuRk4OCQETiYuvOhkhbDGJC/fWs3UxcnEICexjlGj4MIcdwtnAKHF6+XEmCOcRk8TUzxeZ\r
+       IZy5jBL3+lvZQfrZBDQktu1fDjZLREBaYufd2awgNrOAocTlrx0sILawgIXE2YVfmUFsFgFV\r
+       iVeTn4PFeQUcJLbt2M0McYeiRPezCWwTGHkXMDKsYpRNya3SzU3MzClOTdYtTk7My0st0jXS\r
+       y80s0UtNKd3ECA4XSd4djO8OKh1iFOBgVOLh3RFxOkCINbGsuDL3EKMkB5OSKG/G5TMBQnxJ\r
+       +SmVGYnFGfFFpTmpxYcYJTiYlUR4k+YD5XhTEiurUovyYVLSHCxK4rxXUm76CwmkJ5akZqem\r
+       FqQWwWRlODiUJHinXgNqFCxKTU+tSMvMKUFIM3FwggznARreDVLDW1yQmFucmQ6RP8WoKCXO\r
+       uxAkIQCSyCjNg+uFxfMrRnGgV4R5q0CqeICpAK77FdBgJqDBy23ABpckIqSkGhg1WcInhGdK\r
+       x5X9Nl6dYSp5OGCuy0Gl/exXXqadsfvftfzM6bP+qkx7ozjePZzGoZCr9T66Q2DCpvI5c2/9\r
+       WRFaqbe+La7+hJIuqxXbTYdjHD926S1udGUovTRdfQ9PwdH6rx85Tu50+ODQ7eBbX7Pa+ulr\r
+       me983B7r25h2zbOLWSaa5epvL6/EUpyRaKjFXFScCACrPKL1wgIAAA==\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:36 -0000\r
+\r
+This obsoletes id:1355548513-10085-1-git-send-email-amdragon@mit.edu\r
+and fixes the things Mark and Tomi commented on.  The interdiff is\r
+below.\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index cf61635..8f84087 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -326,10 +326,12 @@ the user dismisses it."\r
+     (with-current-buffer buf\r
+       (view-mode-enter nil #'kill-buffer)\r
+       (let ((inhibit-read-only t))\r
++      (goto-char (point-max))\r
++      (unless (bobp)\r
++        (insert "\n"))\r
+       (insert msg)\r
+       (unless (bolp)\r
+-        (insert "\n"))\r
+-      (goto-char (point-min))))\r
++        (insert "\n"))))\r
+     (pop-to-buffer buf)))\r
\r
+ (defun notmuch-check-async-exit-status (proc msg)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index c20de13..b0fd387 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -536,8 +536,9 @@ 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
++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
+@@ -649,7 +650,7 @@ of the result."\r
+                     (insert "Incomplete search results (search process was killed).\n"))\r
+                 (when (eq status 'exit)\r
+                   (insert "End of search results.\n")\r
+-                  (condition-case err\r
++                  (condition-case nil\r
+                       (notmuch-check-async-exit-status proc msg)\r
+                     ;; Suppress the error signal since strange\r
+                     ;; things happen if a sentinel signals.\r
+diff --git a/test/emacs b/test/emacs\r
+index 88b062c..5067d67 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -873,7 +873,7 @@ This is output\r
+ Error: Unexpected output from notmuch search:\r
+ This is an error\r
+ End of search results.\r
+-Error invoking notmuch.  /tmp/nmtest/tmp.emacs/notmuch_fail search --format=json --sort=newest-first tag:inbox exited with status 1."\r
++Error invoking notmuch.  $PWD/notmuch_fail search --format=json --sort=newest-first tag:inbox exited with status 1."\r
\r
\r
+ test_done\r
+diff --git a/test/emacs-show b/test/emacs-show\r
+index c67c6a4..40fab61 100755\r
+--- a/test/emacs-show\r
++++ b/test/emacs-show\r
+@@ -178,7 +178,7 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
+              (with-current-buffer \"*Notmuch errors*\"\r
+                 (test-output \"ERROR\")))"\r
+ test_expect_equal "$(cat OUTPUT ERROR)" "\\r
+-Error invoking notmuch.  /tmp/nmtest/tmp.emacs-show/notmuch_fail show --format=json --exclude=false ' * ' exited with status 1.\r
++Error invoking notmuch.  $PWD/notmuch_fail show --format=json --exclude=false ' * ' exited with status 1.\r
+ Error:\r
+ This is an error\r
+ Output:\r
+\r
+\r