[PATCH] emacs: hello: make --batch error gracefully
authorMark Walters <markwalters1009@gmail.com>
Thu, 4 Jul 2013 22:18:19 +0000 (23:18 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:55:52 +0000 (09:55 -0800)
ec/f99ec1bf9445842ede294eb1f3d178b2a43654 [new file with mode: 0644]

diff --git a/ec/f99ec1bf9445842ede294eb1f3d178b2a43654 b/ec/f99ec1bf9445842ede294eb1f3d178b2a43654
new file mode 100644 (file)
index 0000000..8d93707
--- /dev/null
@@ -0,0 +1,100 @@
+Return-Path: <markwalters1009@gmail.com>\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 E7BBA431FBF\r
+       for <notmuch@notmuchmail.org>; Thu,  4 Jul 2013 15:22:05 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       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 3f-4QbvXrKFL for <notmuch@notmuchmail.org>;\r
+       Thu,  4 Jul 2013 15:22:00 -0700 (PDT)\r
+Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com\r
+       [209.85.215.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 494BE431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  4 Jul 2013 15:22:00 -0700 (PDT)\r
+Received: by mail-ea0-f174.google.com with SMTP id o10so1091354eaj.5\r
+       for <notmuch@notmuchmail.org>; Thu, 04 Jul 2013 15:21:59 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=Da/+w1u8K9SPlIT4tgycDBxjxrR6Whjsp6fwAvssBag=;\r
+       b=ObyxVkZ6SYg/V/0RwjhsNQ9kmRTARVm0skD8R7afODKwJwfNZrMFyz+9f/yyV0DHrz\r
+       MBpx8mp+Iuxa4wU4Z+VJe+Vt6Ra3V7+PH03ukA3JxdOA6oykuh2eeXGjPpCFoA4m6vCW\r
+       sdKUP/QNVMabWe+jo6CP8ZoYW4EjsOTkriMDeh3uRqCgbbCi4mjqlNF5xG48TSG5KAu1\r
+       S3tS8W4dSgal8KxG45VCXtAGM+mmv5+cgpwQbAodJth63+xPVnxaWhCHh5CCvQC/UHzG\r
+       6oXpLCeSnkLgyWKKP+oKQaFYhsbG/mPshEjhX63YUoKqWYbSXTf+vhB8v3nO4T5cfOXN\r
+       YivA==\r
+X-Received: by 10.14.149.141 with SMTP id x13mr8919541eej.77.1372976517745;\r
+       Thu, 04 Jul 2013 15:21:57 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPSA id o5sm8715271eef.5.2013.07.04.15.21.56\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Thu, 04 Jul 2013 15:21:56 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: hello: make --batch error gracefully\r
+Date: Thu,  4 Jul 2013 23:18:19 +0100\r
+Message-Id: <1372976299-30389-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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: Thu, 04 Jul 2013 22:22:06 -0000\r
+\r
+Recently notmuch-hello was converted to use batch count. However, it\r
+seems that several people run different versions of notmuch-emacs and\r
+notmuch-cli so this batch makes emacs fail with an error message if\r
+--batch is not available in the CLI.\r
+---\r
+There have been two cases on irc of people getting backtraces when\r
+hitting this problem so it might be worth adding an informative error\r
+message.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+ emacs/notmuch-hello.el |    9 +++++++--\r
+ 1 files changed, 7 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 147c08c..fa46b7a 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -402,8 +402,13 @@ options will be handled as specified for\r
+                                          (plist-get options :filter)))\r
+        "\n")))\r
\r
+-    (call-process-region (point-min) (point-max) notmuch-command\r
+-                       t t nil "count" "--batch")\r
++    (unless (= (call-process-region (point-min) (point-max) notmuch-command\r
++                                  t t nil "count" "--batch") 0)\r
++      (notmuch-logged-error "notmuch CLI version mismatch error (count --batch)\r
++The most likely cause of this error is that the CLI is too old\r
++to support count --batch and needs to be upgraded to the same\r
++version as notmuch-emacs"))\r
++\r
+     (goto-char (point-min))\r
\r
+     (notmuch-remove-if-not\r
+-- \r
+1.7.9.1\r
+\r