--- /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 1A96D431FD6\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 13:02:10 -0800 (PST)\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 Ugwh1Ey-YG4r for <notmuch@notmuchmail.org>;\r
+ Sun, 23 Feb 2014 13:02:05 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id B09F3431FD9\r
+ for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 13:02:01 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id F2B771001C7; Sun, 23 Feb 2014 23:01:56 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 2/3] emacs: defconst notmuch-emacs-version to a value\r
+ during byte compilation\r
+Date: Sun, 23 Feb 2014 23:01:47 +0200\r
+Message-Id: <1393189308-20241-3-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <1393189308-20241-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1393189308-20241-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.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: Sun, 23 Feb 2014 21:02:10 -0000\r
+\r
+The notmuch cli program and emacs lisp versions may differ. For now\r
+we can help users with their emacs client problems better if we can\r
+ask what version of emacs MUA they are running. In the future we can\r
+put the emacs MUA version to User-Agent: string in outgoing mail.\r
+---\r
+ emacs/Makefile.local | 6 +++++-\r
+ emacs/notmuch.el | 7 +++++++\r
+ 2 files changed, 12 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index 6a39b32..9e3fb7a 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -24,6 +24,8 @@ emacs_images := \\r
+ \r
+ emacs_bytecode = $(emacs_sources:.el=.elc)\r
+ \r
++$(dir)/notmuch.elc: version.stamp\r
++\r
+ # Because of defmacro's and defsubst's, we have to account for load\r
+ # dependencies between Elisp files when byte compiling. Otherwise,\r
+ # the byte compiler may load an old .elc file when processing a\r
+@@ -49,7 +51,9 @@ CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x\r
+ \r
+ ifeq ($(HAVE_EMACS),1)\r
+ %.elc: %.el $(global_deps)\r
+- $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<\r
++ $(call quiet,EMACS) --directory emacs \\r
++ --eval "(setq notmuch--version \"$(VERSION)\")" \\r
++ -batch -f batch-byte-compile $<\r
+ endif\r
+ \r
+ ifeq ($(WITH_EMACS),1)\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 0471750..1b15054 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -81,6 +81,13 @@ To enter a line break in customize, press \\[quoted-insert] C-j."\r
+ :type '(alist :key-type (string) :value-type (string))\r
+ :group 'notmuch-search)\r
+ \r
++;; defconst notmuch-version to a value during build-time byte compilation...\r
++(defconst notmuch-emacs-version\r
++ (eval-when-compile (if (boundp 'notmuch--version)\r
++ notmuch--version\r
++ "unknown"))\r
++ "Version string of this version of Notmuch Emacs MUA.")\r
++\r
+ (defvar notmuch-query-history nil\r
+ "Variable to store minibuffer history for notmuch queries")\r
+ \r
+-- \r
+1.8.0\r
+\r