--- /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 6E039431FC3\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 04:52:00 -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 1xEeYjN0+tXr for <notmuch@notmuchmail.org>;\r
+ Sun, 19 Jan 2014 04:51:55 -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 8C7C3431FC0\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Jan 2014 04:51:55 -0800 (PST)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id D1A681000B3; Sun, 19 Jan 2014 14:51:48 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during\r
+ byte compilation\r
+Date: Sun, 19 Jan 2014 14:51:42 +0200\r
+Message-Id: <1390135903-28167-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.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: Sun, 19 Jan 2014 12:52:00 -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 | 4 +++-\r
+ emacs/notmuch-lib.el | 7 +++++++\r
+ 2 files changed, 10 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index 42bfbd9..1b2db7e 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -40,7 +40,9 @@ CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp\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-lib.el b/emacs/notmuch-lib.el\r
+index 2be409b..81eed54 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -168,6 +168,13 @@ Otherwise the output will be returned"\r
+ (notmuch-check-exit-status status (cons notmuch-command args) output)\r
+ output)))\r
+ \r
++;; defconst notmuch-emacs-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
++ "not-compiled"))\r
++ "Version string of this version of Notmuch Emacs MUA.")\r
++\r
+ (defun notmuch-version ()\r
+ "Return a string with the notmuch version number."\r
+ (let ((long-string\r
+-- \r
+1.8.4.2\r
+\r