From: Mark Walters Date: Sun, 21 Jul 2013 08:28:24 +0000 (+0100) Subject: Re: [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f2541ed04e305d1bb33fa455a952e04d21f74230;p=notmuch-archives.git Re: [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI --- diff --git a/1c/98cc037e8eec288e22b338ad55709f3db27205 b/1c/98cc037e8eec288e22b338ad55709f3db27205 new file mode 100644 index 000000000..7a64498b8 --- /dev/null +++ b/1c/98cc037e8eec288e22b338ad55709f3db27205 @@ -0,0 +1,173 @@ +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 6DD76431FBF + for ; Sun, 21 Jul 2013 01:28:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 QAjEgTtKoq83 for ; + Sun, 21 Jul 2013 01:28:30 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id BDD29431FB6 + for ; Sun, 21 Jul 2013 01:28:29 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1V0p0E-0003St-22; Sun, 21 Jul 2013 09:28:28 +0100 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1V0p0D-0000ws-Nj; Sun, 21 Jul 2013 09:28:25 +0100 +From: Mark Walters +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [DRAFT PATCH] emacs: notmuch-version and version comparison with + CLI +In-Reply-To: <1374090782-10273-1-git-send-email-tomi.ollila@iki.fi> +References: <1374090782-10273-1-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.15.2+192~g8222af3 (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Sun, 21 Jul 2013 09:28:24 +0100 +Message-ID: <87li508ggn.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: e2a6555cedf29fa8db065af3fabd1b0f (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: tomi.ollila@iki.fi +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: Sun, 21 Jul 2013 08:28:34 -0000 + + +Hi + +I think I would prefer some more specific versioning so that we don't +have the warning unless we think we might need it. I often run notmuch +over ssh and the two sides are often minorly out of sync so I think I +would find a warning each time irritating. + +Maybe basing the message on "version + commits since last release" with + emacs knowing some minimum acceptable version? + +Best wishes + +Mark + + + Tomi Ollila writes: + +> --- +> +> This is continuation of id:m2y59ag9yj.fsf@guru.guru-group.fi +> +> This is draft of code which could be used to do exact version comparison +> between notmuch cli and notmuch Emacs MUA. +> +> In case the versions aren't exactly same a warning message is shown +> to the user before notmuch-hello window is filled the first time. +> +> If this approach gets support I'll write more prepared patches +> (in addition to make fully working patch...). +> +> Tomi +> +> emacs/Makefile.local | 4 +++- +> emacs/notmuch-hello.el | 26 +++++++++++++++++++++++++- +> 2 files changed, 28 insertions(+), 2 deletions(-) +> +> diff --git a/emacs/Makefile.local b/emacs/Makefile.local +> index a910aff..fd45d4a 100644 +> --- a/emacs/Makefile.local +> +++ b/emacs/Makefile.local +> @@ -36,7 +36,9 @@ $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources) +> CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp +> +> %.elc: %.el $(global_deps) +> - $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $< +> + $(call quiet,EMACS) --directory emacs \ +> + --eval "(setq notmuch--version \"$(VERSION)\")" \ +> + -batch -f batch-byte-compile $< +> +> ifeq ($(WITH_EMACS),1) +> ifeq ($(HAVE_EMACS),1) +> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el +> index 147c08c..d97aee3 100644 +> --- a/emacs/notmuch-hello.el +> +++ b/emacs/notmuch-hello.el +> @@ -29,6 +29,18 @@ +> (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation)) +> (declare-function notmuch-poll "notmuch" ()) +> +> +;; defconst notmuch-version to a value during build-time byte compilation... +> +;; the compiled output will only contain the defconst definition +> +(eval-when-compile +> + (defmacro expand-defconst-notmuch-version () +> + `(if ,(boundp 'notmuch--version) +> + (defconst notmuch-version ,notmuch--version +> + "Version string for this version of Notmuch.") +> + (defconst notmuch-version "unknown" +> + "Placeholder for Notmuch version string. Set during build process."))) +> +) +> +(expand-defconst-notmuch-version) +> + +> (defcustom notmuch-hello-recent-searches-max 10 +> "The number of recent searches to display." +> :type 'integer +> @@ -762,7 +774,19 @@ following: +> +> (if no-display +> (set-buffer "*notmuch-hello*") +> - (switch-to-buffer "*notmuch-hello*")) +> + (switch-to-buffer "*notmuch-hello*") +> + (if notmuch-hello-first-run +> + (let ((v (replace-regexp-in-string "^notmuch " "" +> + (car (process-lines notmuch-command +> + "--version"))))) +> + (unless (string= v notmuch-version) +> + (save-excursion +> + (erase-buffer) +> + (insert " +> +Notmuch CLI version: " v " +> +Notmuch Emacs version: " notmuch-version " +> + +> +XXX") (y-or-n-p "Press y or n to continue")))))) +> +> (let ((target-line (line-number-at-pos)) +> (target-column (current-column)) +> -- +> 1.8.1.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch