unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH v4 2/3] emacs: add notmuch-version.el.tmpl and create notmuch-version.el from it
Date: Wed, 19 Mar 2014 22:37:10 +0200	[thread overview]
Message-ID: <1395261431-24668-2-git-send-email-tomi.ollila@iki.fi> (raw)
In-Reply-To: <1395261431-24668-1-git-send-email-tomi.ollila@iki.fi>

The notmuch cli program and emacs lisp versions may differ (especially
in remote usage). It helps to resolve problems if we can determine
the versions of notmuch cli and notmuch emacs mua separately.

The build process now creates notmuch-version.el from template file
by filling the version info to notmuch-emacs-version variable.
---
 emacs/.gitignore              |  1 +
 emacs/Makefile.local          | 11 +++++++++--
 emacs/notmuch-version.el.tmpl | 23 +++++++++++++++++++++++
 emacs/notmuch.el              |  4 ++++
 4 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 emacs/notmuch-version.el.tmpl

diff --git a/emacs/.gitignore b/emacs/.gitignore
index 5421301..9fa1c44 100644
--- a/emacs/.gitignore
+++ b/emacs/.gitignore
@@ -1,2 +1,3 @@
 .eldeps*
 *.elc
+notmuch-version.el
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 6a39b32..ca039e5 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -17,7 +17,14 @@ emacs_sources := \
 	$(dir)/notmuch-crypto.el \
 	$(dir)/notmuch-tag.el \
 	$(dir)/coolj.el \
-	$(dir)/notmuch-print.el
+	$(dir)/notmuch-print.el \
+	$(dir)/notmuch-version.el
+
+$(dir)/notmuch-version.el: $(dir)/Makefile.local version.stamp
+$(dir)/notmuch-version.el: $(dir)/notmuch-version.el.tmpl
+	@sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
+	     -e 's/%VERSION%/"$(VERSION)"/' $< > $@
+
 
 emacs_images := \
 	$(srcdir)/$(dir)/notmuch-logo.png
@@ -71,4 +78,4 @@ endif
 	mkdir -p "$(DESTDIR)$(emacsetcdir)"
 	install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
 
-CLEAN := $(CLEAN) $(emacs_bytecode)
+CLEAN := $(CLEAN) $(emacs_bytecode) $(dir)/notmuch-version.el
diff --git a/emacs/notmuch-version.el.tmpl b/emacs/notmuch-version.el.tmpl
new file mode 100644
index 0000000..6cf367b
--- /dev/null
+++ b/emacs/notmuch-version.el.tmpl
@@ -0,0 +1,23 @@
+;; -*- emacs-lisp -*-
+;;
+;; %AG%
+;;
+;; This file is part of Notmuch.
+;;
+;; Notmuch is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; Notmuch is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
+
+(defconst notmuch-emacs-version %VERSION%
+  "Version string of this version of Notmuch Emacs MUA.")
+
+(provide 'notmuch-version)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 0471750..b7dd944 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -61,6 +61,10 @@
 (require 'notmuch-message)
 (require 'notmuch-parser)
 
+(unless (require 'notmuch-version nil t)
+  (defconst notmuch-emacs-version "unknown"
+    "Placeholder variable when notmuch-version.el[c] is not available."))
+
 (defcustom notmuch-search-result-format
   `(("date" . "%12s ")
     ("count" . "%-7s ")
-- 
1.8.0

  parent reply	other threads:[~2014-03-19 20:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 20:37 [PATCH v4 1/3] build: write version.stamp file containing $(VERSION) string Tomi Ollila
2014-03-19 20:37 ` Tomi Ollila
2014-03-19 20:37 ` Tomi Ollila [this message]
2014-04-06 18:42   ` [PATCH v4 2/3] emacs: add notmuch-version.el.tmpl and create notmuch-version.el from it David Bremner
2014-04-07  9:22     ` Tomi Ollila
2014-04-07 10:15       ` David Bremner
2014-03-19 20:37 ` [PATCH v4 3/3] emacs: defun notmuch-hello-versions and bind 'v' in hello mode to it Tomi Ollila
2014-04-07 18:05 ` [PATCH v4 2/3] emacs: add notmuch-version.el.tmpl and create notmuch-version.el from it Tomi Ollila
2014-04-11  2:49   ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395261431-24668-2-git-send-email-tomi.ollila@iki.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).