From: Tomi Ollila Date: Sat, 6 Jul 2013 09:06:22 +0000 (+0300) Subject: Re: [PATCH] emacs: hello: make --batch error gracefully X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=23029d67793accdc65be57be4dad513726ba9d29;p=notmuch-archives.git Re: [PATCH] emacs: hello: make --batch error gracefully --- diff --git a/ce/7b6ad450945f667e4977555f0768ee857b8653 b/ce/7b6ad450945f667e4977555f0768ee857b8653 new file mode 100644 index 000000000..294a5be5e --- /dev/null +++ b/ce/7b6ad450945f667e4977555f0768ee857b8653 @@ -0,0 +1,133 @@ +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 D7586431FAF + for ; Sat, 6 Jul 2013 02:06:35 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 K9JY4+kpNyCA for ; + Sat, 6 Jul 2013 02:06:31 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 91864431FAE + for ; Sat, 6 Jul 2013 02:06:31 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 0440B100051; + Sat, 6 Jul 2013 12:06:23 +0300 (EEST) +From: Tomi Ollila +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: hello: make --batch error gracefully +In-Reply-To: <1372976299-30389-1-git-send-email-markwalters1009@gmail.com> +References: <1372976299-30389-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Notmuch/0.15.2+193~g7350bd4 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Sat, 06 Jul 2013 09:06:36 -0000 + +On Fri, Jul 05 2013, Mark Walters wrote: + +> 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. + +This change takes care of the mismatching version problem now -- for +a short while in most cases but in the future we might face with new +incompabilities that would -- again -- need new solution. Some day +we might have a pile of these who everyone is shy to remove from the +code base ;/ + +Although I am not against applying this patch (if there are supporters +of this) I'd like to concentrate fixing this for example the following +way: + +We'll add a global option to notmuch, e.g. + +--compatibility-version=x.y + +Whenever the caller chooses to use this option, notmuch checks whether +it can comply with the option -- it it can, execution continues, otherwise +aborts. + +The compatibility is determined so that the major 'x' needs to be same +and caller may have lower 'y' that notmuch is capable of handling. + +For example. if notmuch compatibility version was 2.5 + +--compatibility-version=1.9 -- abort +--compatibility-version=2.3 -- continue +--compatibility-version=2.5 -- continue +--compatibility-version=2.8 -- abort +--compatibility-version=3.1 -- abort + + +I can work on this (or on something similar) if this is generally thought +as a good idea... + +> +> Best wishes +> +> Mark + +Tomi + + +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch