--- /dev/null
+Return-Path: <too@guru-group.fi>\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 1606D431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 8 Aug 2014 04:20:04 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 JyDH-esi1q0o for <notmuch@notmuchmail.org>;\r
+ Fri, 8 Aug 2014 04:19:56 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9C5EA431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 8 Aug 2014 04:19:55 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 73AEE1000E0; Fri, 8 Aug 2014 14:19:42 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: prefer notmuch-emacs-version in User-Agent: header\r
+Date: Fri, 8 Aug 2014 14:19:41 +0300\r
+Message-Id: <1407496781-17458-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.0.0\r
+Cc: tomi.ollila@iki.fi\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: Fri, 08 Aug 2014 11:20:04 -0000\r
+\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
+removed from `notmuch-version' to `notmuch-cli-version' to make things\r
+clearer and more consistent.\r
+---\r
+ NEWS | 14 ++++++++++++++\r
+ emacs/notmuch-hello.el | 2 +-\r
+ emacs/notmuch-lib.el | 4 ++--\r
+ emacs/notmuch-mua.el | 11 ++++++++---\r
+ 4 files changed, 25 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/NEWS b/NEWS\r
+index f7aaedf91d07..9664146768f3 100644\r
+--- a/NEWS\r
++++ b/NEWS\r
+@@ -7,6 +7,20 @@ Library changes\r
+ Add return status to notmuch_database_close and\r
+ notmuch_database_destroy\r
+ \r
++Emacs Interface\r
++---------------\r
++\r
++`notmuch-emacs-version` is used in `User-Agent` header\r
++\r
++ The value of recently introduced variable `notmuch-emacs-version` is\r
++ now used as a part of `User-Agent` header when sending emails.\r
++\r
++Removed `notmuch-version` function by renaming it to `notmuch-cli-version`\r
++\r
++ With existing variable `notmuch-emacs-version` the accompanied\r
++ function which retrieves the version of `notmuch-command` is\r
++ better named as `notmuch-cli-version`.\r
++\r
+ nmbug-status\r
+ ------------\r
+ \r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 65d062760a71..7bfa752d2a04 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -628,7 +628,7 @@ (defvar notmuch-emacs-version)\r
+ (defun notmuch-hello-versions ()\r
+ "Display the notmuch version(s)"\r
+ (interactive)\r
+- (let ((notmuch-cli-version (notmuch-version)))\r
++ (let ((notmuch-cli-version (notmuch-cli-version)))\r
+ (message "notmuch version %s"\r
+ (if (string= notmuch-emacs-version notmuch-cli-version)\r
+ notmuch-cli-version\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index 19269e3c469b..ca18ff9d5487 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -192,8 +192,8 @@ (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
+- "Return a string with the notmuch version number."\r
++(defun notmuch-cli-version ()\r
++ "Return a string with the notmuch-command version number."\r
+ (let ((long-string\r
+ ;; Trim off the trailing newline.\r
+ (substring (notmuch-command-to-string "--version") 0 -1)))\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 2c5888600b6c..dbf5df28669d 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -100,12 +100,17 @@ (defun notmuch-mua-user-agent-full ()\r
+ " "\r
+ (notmuch-mua-user-agent-emacs)))\r
+ \r
++;; the following variable is defined as being defconst in notmuch-version.el\r
++(defvar notmuch-emacs-version)\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
++ "Generate notmuch part of `User-Agent:' string suitable for notmuch."\r
++ (concat "Notmuch/" (if (string= notmuch-emacs-version "unknown")\r
++ (notmuch-cli-version)\r
++ notmuch-emacs-version) " (http://notmuchmail.org)"))\r
+ \r
+ (defun notmuch-mua-user-agent-emacs ()\r
+- "Generate a `User-Agent:' string suitable for notmuch."\r
++ "Generate emacs part of `User-Agent:' string suitable for notmuch."\r
+ (concat "Emacs/" emacs-version " (" system-configuration ")"))\r
+ \r
+ (defun notmuch-mua-add-more-hidden-headers ()\r
+-- \r
+2.0.0\r
+\r