--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 5835E6DE0AA2\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 09:14:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.648\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.648 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,\r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id PJFknf8HkZ2f for <notmuch@notmuchmail.org>;\r
+ Sun, 5 Apr 2015 09:14:21 -0700 (PDT)\r
+X-Greylist: delayed 1545 seconds by postgrey-1.35 at arlo;\r
+ Sun, 05 Apr 2015 09:14:20 PDT\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id C2DCB6DE1A2F\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 09:14:20 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YenBh-0002fJ-N9; Sun, 05 Apr 2015 17:14:18 +0100\r
+Received: from 94.197.113.50.threembb.co.uk ([94.197.113.50] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1YenBf-0004RY-Hk; Sun, 05 Apr 2015 17:14:17 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2] emacs: prefer notmuch-emacs-version in User-Agent:\r
+ header\r
+In-Reply-To: <1426932955-23174-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1426932955-23174-1-git-send-email-tomi.ollila@iki.fi>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 05 Apr 2015 17:14:10 +0100\r
+Message-ID: <87lhi61rjh.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 94.197.113.50\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: b1be2c50947868a80d7ad463ba283e8b (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider\r
+ * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * -0.1 AWL AWL: Adjusted score from AWL reputation of From: address\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Sun, 05 Apr 2015 16:14:24 -0000\r
+\r
+\r
+On Sat, 21 Mar 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA\r
+> use that as a part of User-Agent: header to provide more accurate\r
+> version information when sending emails.\r
+>\r
+> In case some incomplete installation of notmuch emacs MUA is used and\r
+> `notmuch-emacs-version' is defined as "unknown" then fall back to ask\r
+> version info from cli (as it used to be) -- the function to do that was\r
+> renamed from `notmuch-version' to `notmuch-cli-version' to make this\r
+> clearer and more consistent.\r
+>\r
+> The hub of getting version information is new `notmuch-versions'\r
+> function. It normally returns cons pair\r
+> (notmuch-emacs-version . notmuch-cli-version).\r
+> This function takes optional argument which makes the cdr of the return\r
+> value work differently; if `notmuch-emacs-version' is "unknown", return\r
+> pair as if the option were not given; otherwise return\r
+> (notmuch-emacs-version . notmuch-emacs-version).\r
+> This special case is useful to simplify setting User-Agent: header\r
+> -- just use the cdr of the returned value.\r
+\r
+Hi\r
+\r
+At the moment I am not seeing the advantages of this approach over that\r
+Michal suggested in id:87oau1un7g.fsf@steelpick.2x.cz (with a\r
+notmuch-guess-emacs-version) which looks a little simpler; could you\r
+explain?\r
+\r
+(Just in case its not clear: I like the renaming of notmuch-version to\r
+notmuch-cli-version but I feel putting the guessing logic in\r
+notmuch-versions with an optional argument is overloading that function,\r
+and I am not sure what the advantage of having that function is)\r
+\r
+\r
+Many thanks\r
+\r
+Mark\r
+\r
+\r
+\r
+> ---\r
+>\r
+> This is v2 of id:1407496781-17458-1-git-send-email-tomi.ollila@iki.fi\r
+>\r
+> (NEWS dropped from this one (for now) -- will arrive later)\r
+>\r
+> emacs/notmuch-hello.el | 13 +++++--------\r
+> emacs/notmuch-lib.el | 20 +++++++++++++++++++-\r
+> emacs/notmuch-mua.el | 2 +-\r
+> emacs/notmuch.el | 4 ----\r
+> 4 files changed, 25 insertions(+), 14 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+> index 65d0627..62345fe 100644\r
+> --- a/emacs/notmuch-hello.el\r
+> +++ b/emacs/notmuch-hello.el\r
+> @@ -622,18 +622,15 @@ (defun notmuch-hello-window-configuration-change ()\r
+> (remove-hook 'window-configuration-change-hook\r
+> #'notmuch-hello-window-configuration-change))))\r
+> \r
+> -;; the following variable is defined as being defconst in notmuch-version.el\r
+> -(defvar notmuch-emacs-version)\r
+> -\r
+> (defun notmuch-hello-versions ()\r
+> "Display the notmuch version(s)"\r
+> (interactive)\r
+> - (let ((notmuch-cli-version (notmuch-version)))\r
+> + (let ((notmuch-versions (notmuch-versions)))\r
+> (message "notmuch version %s"\r
+> - (if (string= notmuch-emacs-version notmuch-cli-version)\r
+> - notmuch-cli-version\r
+> - (concat notmuch-cli-version\r
+> - " (emacs mua version " notmuch-emacs-version ")")))))\r
+> + (if (string= (car notmuch-versions) (cdr notmuch-versions))\r
+> + (car notmuch-versions)\r
+> + (concat (cdr notmuch-versions)\r
+> + " (emacs mua version " (car notmuch-versions) ")")))))\r
+> \r
+> (defvar notmuch-hello-mode-map\r
+> (let ((map (if (fboundp 'make-composed-keymap)\r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index f8e5165..370b648 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -25,6 +25,10 @@\r
+> (require 'mm-decode)\r
+> (require 'cl)\r
+> \r
+> +(unless (require 'notmuch-version nil t)\r
+> + (defconst notmuch-emacs-version "unknown"\r
+> + "Placeholder variable when notmuch-version.el[c] is not available."))\r
+> +\r
+> (autoload 'notmuch-jump-search "notmuch-jump"\r
+> "Jump to a saved search by shortcut key." t)\r
+> \r
+> @@ -192,7 +196,7 @@ (defun notmuch-assert-cli-sane ()\r
+> "Perhaps you haven't run \"notmuch setup\" yet? Try running this\r
+> on the command line, and then retry your notmuch command")))\r
+> \r
+> -(defun notmuch-version ()\r
+> +(defun notmuch-cli-version ()\r
+> "Return a string with the notmuch version number."\r
+> (let ((long-string\r
+> ;; Trim off the trailing newline.\r
+> @@ -202,6 +206,20 @@ (defun notmuch-version ()\r
+> (match-string 2 long-string)\r
+> "unknown")))\r
+> \r
+> +(defun notmuch-versions (&optional cdr-as-emacs-version-unless-unknown)\r
+> + "Returns cons pair (notmuch-emacs-version . (`notmuch-cli-version'))\r
+> +If optional argument CDR-AS-EMACS-VERSION-UNLESS-UNKNOWN is non-nil\r
+> +and `notmuch-emacs-version' is not \"unknown\" return cons pair\r
+> +(notmuch-emacs-version . notmuch-emacs-version).\r
+> +`notmuch-mua-user-agent-notmuch' utilizes this option, and uses the cdr\r
+> +of this cons pair in User-Agent: header"\r
+> + (interactive)\r
+> + (cons notmuch-emacs-version\r
+> + (if (or (not cdr-as-emacs-version-unless-unknown)\r
+> + (string= notmuch-emacs-version "unknown"))\r
+> + (notmuch-cli-version)\r
+> + notmuch-emacs-version)))\r
+> +\r
+> (defun notmuch-config-get (item)\r
+> "Return a value from the notmuch configuration."\r
+> (let* ((val (notmuch-command-to-string "config" "get" item))\r
+> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+> index 33f1399..ac067f2 100644\r
+> --- a/emacs/notmuch-mua.el\r
+> +++ b/emacs/notmuch-mua.el\r
+> @@ -118,7 +118,7 @@ (defun notmuch-mua-user-agent-full ()\r
+> \r
+> (defun notmuch-mua-user-agent-notmuch ()\r
+> "Generate a `User-Agent:' string suitable for notmuch."\r
+> - (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)"))\r
+> + (concat "Notmuch/" (cdr (notmuch-versions t)) " (http://notmuchmail.org)"))\r
+> \r
+> (defun notmuch-mua-user-agent-emacs ()\r
+> "Generate a `User-Agent:' string suitable for notmuch."\r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index ab00454..0cae117 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -61,10 +61,6 @@\r
+> (require 'notmuch-message)\r
+> (require 'notmuch-parser)\r
+> \r
+> -(unless (require 'notmuch-version nil t)\r
+> - (defconst notmuch-emacs-version "unknown"\r
+> - "Placeholder variable when notmuch-version.el[c] is not available."))\r
+> -\r
+> (defcustom notmuch-search-result-format\r
+> `(("date" . "%12s ")\r
+> ("count" . "%-7s ")\r
+> -- \r
+> 2.1.0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r