unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation
@ 2014-01-19 12:51 Tomi Ollila
  2014-01-19 12:51 ` [PATCH 2/2] emacs: defun notmuch-hello-versions and bind 'v' in hello mode to it Tomi Ollila
  2014-01-23 18:12 ` [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Mark Walters
  0 siblings, 2 replies; 4+ messages in thread
From: Tomi Ollila @ 2014-01-19 12:51 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

The notmuch cli program and emacs lisp versions may differ. For now
we can help users with their emacs client problems better if we can
ask what version of emacs MUA they are running. In the future we can
put the emacs MUA version to User-Agent: string in outgoing mail.
---
 emacs/Makefile.local | 4 +++-
 emacs/notmuch-lib.el | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 42bfbd9..1b2db7e 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -40,7 +40,9 @@ CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
 
 ifeq ($(HAVE_EMACS),1)
 %.elc: %.el $(global_deps)
-	$(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
+	$(call quiet,EMACS) --directory emacs \
+		--eval "(setq notmuch--version \"$(VERSION)\")" \
+		-batch -f batch-byte-compile $<
 endif
 
 ifeq ($(WITH_EMACS),1)
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 2be409b..81eed54 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -168,6 +168,13 @@ Otherwise the output will be returned"
       (notmuch-check-exit-status status (cons notmuch-command args) output)
       output)))
 
+;; defconst notmuch-emacs-version to a value during build-time byte compilation
+(defconst notmuch-emacs-version
+  (eval-when-compile (if (boundp 'notmuch--version)
+			 notmuch--version
+		       "not-compiled"))
+  "Version string of this version of Notmuch Emacs MUA.")
+
 (defun notmuch-version ()
   "Return a string with the notmuch version number."
   (let ((long-string
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] emacs: defun notmuch-hello-versions and bind 'v' in hello mode to it
  2014-01-19 12:51 [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Tomi Ollila
@ 2014-01-19 12:51 ` Tomi Ollila
  2014-01-23 18:12 ` [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Mark Walters
  1 sibling, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2014-01-19 12:51 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

If notmuch cli & notmuch emacs MUA versions differ, print also the
emacs MUA version string (along with the cli version) to the
minibuffer.
---
 emacs/notmuch-hello.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 55c416a..299e35f 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -513,6 +513,15 @@ Such a list can be computed with `notmuch-hello-query-counts'."
       (remove-hook 'window-configuration-change-hook
 		   #'notmuch-hello-window-configuration-change))))
 
+(defun notmuch-hello-versions ()
+  "Display the notmuch version(s)"
+  (interactive)
+  (let ((notmuch-cli-version (notmuch-version)))
+    (message "notmuch version %s"
+	     (if (string= notmuch-emacs-version notmuch-cli-version)
+		 notmuch-cli-version
+	       (concat notmuch-cli-version
+		       " (Emacs MUA version " notmuch-emacs-version ")")))))
 
 (defvar notmuch-hello-mode-map
   (let ((map (if (fboundp 'make-composed-keymap)
@@ -523,8 +532,7 @@ Such a list can be computed with `notmuch-hello-query-counts'."
 	       ;; it's unlikely to change.
 	       (copy-keymap widget-keymap))))
     (set-keymap-parent map notmuch-common-keymap)
-    (define-key map "v" (lambda () "Display the notmuch version" (interactive)
-			  (message "notmuch version %s" (notmuch-version))))
+    (define-key map "v" 'notmuch-hello-versions)
     (define-key map (kbd "<C-tab>") 'widget-backward)
     map)
   "Keymap for \"notmuch hello\" buffers.")
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation
  2014-01-19 12:51 [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Tomi Ollila
  2014-01-19 12:51 ` [PATCH 2/2] emacs: defun notmuch-hello-versions and bind 'v' in hello mode to it Tomi Ollila
@ 2014-01-23 18:12 ` Mark Walters
  2014-01-23 23:45   ` David Bremner
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Walters @ 2014-01-23 18:12 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila


Hi

I like this. However, something odd seems to happen with version.

If I make and then commit a small change to emacs/notmuch-tree.el and then
remake then version string in the cli nor in emacs seems to be
updated. If I make clean and then make it is updated.

OTOH if i make then commit a small change to notmuch.c then make again
then  the cli seems to get a new version but emacs doesn't.

I think that this problem (if it's not just stupidity on my part) is
orthogonal to this patch but thought it worth mentioning.

Best wishes

Mark


On Sun, 19 Jan 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> The notmuch cli program and emacs lisp versions may differ. For now
> we can help users with their emacs client problems better if we can
> ask what version of emacs MUA they are running. In the future we can
> put the emacs MUA version to User-Agent: string in outgoing mail.
> ---
>  emacs/Makefile.local | 4 +++-
>  emacs/notmuch-lib.el | 7 +++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index 42bfbd9..1b2db7e 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -40,7 +40,9 @@ CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
>  
>  ifeq ($(HAVE_EMACS),1)
>  %.elc: %.el $(global_deps)
> -	$(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
> +	$(call quiet,EMACS) --directory emacs \
> +		--eval "(setq notmuch--version \"$(VERSION)\")" \
> +		-batch -f batch-byte-compile $<
>  endif
>  
>  ifeq ($(WITH_EMACS),1)
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 2be409b..81eed54 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -168,6 +168,13 @@ Otherwise the output will be returned"
>        (notmuch-check-exit-status status (cons notmuch-command args) output)
>        output)))
>  
> +;; defconst notmuch-emacs-version to a value during build-time byte compilation
> +(defconst notmuch-emacs-version
> +  (eval-when-compile (if (boundp 'notmuch--version)
> +			 notmuch--version
> +		       "not-compiled"))
> +  "Version string of this version of Notmuch Emacs MUA.")
> +
>  (defun notmuch-version ()
>    "Return a string with the notmuch version number."
>    (let ((long-string
> -- 
> 1.8.4.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation
  2014-01-23 18:12 ` [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Mark Walters
@ 2014-01-23 23:45   ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2014-01-23 23:45 UTC (permalink / raw)
  To: Mark Walters, Tomi Ollila, notmuch; +Cc: tomi.ollila

Mark Walters <markwalters1009@gmail.com> writes:

> If I make and then commit a small change to emacs/notmuch-tree.el and then
> remake then version string in the cli nor in emacs seems to be
> updated. If I make clean and then make it is updated.

I think I understand why this is happening: notmuch-lib.el is not
recompiled if it isn't modified. I'm not sure of the best fix, but I
guess the dependencies in emacs/.eldeps need to be updated.  One option
would be to have a seperate notmuch-version.el that depends on
everything.

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-23 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-19 12:51 [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Tomi Ollila
2014-01-19 12:51 ` [PATCH 2/2] emacs: defun notmuch-hello-versions and bind 'v' in hello mode to it Tomi Ollila
2014-01-23 18:12 ` [PATCH 1/2] emacs: defconst notmuch-emacs-version to a value during byte compilation Mark Walters
2014-01-23 23:45   ` David Bremner

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).