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