--- /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 arlo.cworth.org (Postfix) with ESMTP id 22FD26DE1413\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Aug 2015 07:48:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.307\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.307 tagged_above=-999 required=5 tests=[AWL=0.847, \r
+ RP_MATCHES_RCVD=-0.55, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01]\r
+ 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 gqeejnsDkrxa for <notmuch@notmuchmail.org>;\r
+ Sun, 2 Aug 2015 07:48:45 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id BCB046DE1410\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Aug 2015 07:48:44 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id B8C881000B3; Sun, 2 Aug 2015 17:48:26 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org,\r
+ markwalters1009@gmail.com,\r
+ sojkam1@fel.cvut.cz\r
+Subject: [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header\r
+Date: Sun, 2 Aug 2015 17:48:14 +0300\r
+Message-Id: <1438526894-19657-2-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 2.0.0\r
+In-Reply-To: <1438526894-19657-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1438526894-19657-1-git-send-email-tomi.ollila@iki.fi>\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, 02 Aug 2015 14:48:49 -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 before this commit).\r
+\r
+Requiring notmuch-version[.elc] and if that is missing setting\r
+"fallback" notmuch-emacs-version (to "unknown") was moved from\r
+notmuch.el to notmuch-lib.el as notmuch-mua.el (which provides\r
+User-Agent: information) require's the latter.\r
+---\r
+\r
+Note that I did not create notmuch-guess-emacs-version (or something)\r
+function. The idea is good but there is one HARD problem: naming it.\r
+Also, I personally suspect that no-one is going to need that function in\r
+coming years...\r
+\r
+ emacs/notmuch-lib.el | 4 ++++\r
+ emacs/notmuch-mua.el | 5 ++++-\r
+ emacs/notmuch.el | 4 ----\r
+ 3 files changed, 8 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index e16a1b9..201d7ec 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
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 934f6c9..3e52d5e 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -118,7 +118,10 @@ (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-cli-version) " (http://notmuchmail.org)"))\r
++ (let ((notmuch-version (if (string= notmuch-emacs-version "unknown")\r
++ (notmuch-cli-version)\r
++ notmuch-emacs-version)))\r
++ (concat "Notmuch/" notmuch-version " (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 6564816..5284e77 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
+1.9.3\r
+\r