* [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI
@ 2013-07-17 19:53 Tomi Ollila
2013-07-21 8:28 ` Mark Walters
0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2013-07-17 19:53 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
---
This is continuation of id:m2y59ag9yj.fsf@guru.guru-group.fi
This is draft of code which could be used to do exact version comparison
between notmuch cli and notmuch Emacs MUA.
In case the versions aren't exactly same a warning message is shown
to the user before notmuch-hello window is filled the first time.
If this approach gets support I'll write more prepared patches
(in addition to make fully working patch...).
Tomi
emacs/Makefile.local | 4 +++-
emacs/notmuch-hello.el | 26 +++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index a910aff..fd45d4a 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -36,7 +36,9 @@ $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
%.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 $<
ifeq ($(WITH_EMACS),1)
ifeq ($(HAVE_EMACS),1)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 147c08c..d97aee3 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -29,6 +29,18 @@
(declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
(declare-function notmuch-poll "notmuch" ())
+;; defconst notmuch-version to a value during build-time byte compilation...
+;; the compiled output will only contain the defconst definition
+(eval-when-compile
+ (defmacro expand-defconst-notmuch-version ()
+ `(if ,(boundp 'notmuch--version)
+ (defconst notmuch-version ,notmuch--version
+ "Version string for this version of Notmuch.")
+ (defconst notmuch-version "unknown"
+ "Placeholder for Notmuch version string. Set during build process.")))
+)
+(expand-defconst-notmuch-version)
+
(defcustom notmuch-hello-recent-searches-max 10
"The number of recent searches to display."
:type 'integer
@@ -762,7 +774,19 @@ following:
(if no-display
(set-buffer "*notmuch-hello*")
- (switch-to-buffer "*notmuch-hello*"))
+ (switch-to-buffer "*notmuch-hello*")
+ (if notmuch-hello-first-run
+ (let ((v (replace-regexp-in-string "^notmuch " ""
+ (car (process-lines notmuch-command
+ "--version")))))
+ (unless (string= v notmuch-version)
+ (save-excursion
+ (erase-buffer)
+ (insert "
+Notmuch CLI version: " v "
+Notmuch Emacs version: " notmuch-version "
+
+XXX") (y-or-n-p "Press y or n to continue"))))))
(let ((target-line (line-number-at-pos))
(target-column (current-column))
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI
2013-07-17 19:53 [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI Tomi Ollila
@ 2013-07-21 8:28 ` Mark Walters
2013-07-21 8:49 ` Tomi Ollila
0 siblings, 1 reply; 3+ messages in thread
From: Mark Walters @ 2013-07-21 8:28 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
Hi
I think I would prefer some more specific versioning so that we don't
have the warning unless we think we might need it. I often run notmuch
over ssh and the two sides are often minorly out of sync so I think I
would find a warning each time irritating.
Maybe basing the message on "version + commits since last release" with
emacs knowing some minimum acceptable version?
Best wishes
Mark
Tomi Ollila <tomi.ollila@iki.fi> writes:
> ---
>
> This is continuation of id:m2y59ag9yj.fsf@guru.guru-group.fi
>
> This is draft of code which could be used to do exact version comparison
> between notmuch cli and notmuch Emacs MUA.
>
> In case the versions aren't exactly same a warning message is shown
> to the user before notmuch-hello window is filled the first time.
>
> If this approach gets support I'll write more prepared patches
> (in addition to make fully working patch...).
>
> Tomi
>
> emacs/Makefile.local | 4 +++-
> emacs/notmuch-hello.el | 26 +++++++++++++++++++++++++-
> 2 files changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/emacs/Makefile.local b/emacs/Makefile.local
> index a910aff..fd45d4a 100644
> --- a/emacs/Makefile.local
> +++ b/emacs/Makefile.local
> @@ -36,7 +36,9 @@ $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
> CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
>
> %.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 $<
>
> ifeq ($(WITH_EMACS),1)
> ifeq ($(HAVE_EMACS),1)
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 147c08c..d97aee3 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -29,6 +29,18 @@
> (declare-function notmuch-search "notmuch" (&optional query oldest-first target-thread target-line continuation))
> (declare-function notmuch-poll "notmuch" ())
>
> +;; defconst notmuch-version to a value during build-time byte compilation...
> +;; the compiled output will only contain the defconst definition
> +(eval-when-compile
> + (defmacro expand-defconst-notmuch-version ()
> + `(if ,(boundp 'notmuch--version)
> + (defconst notmuch-version ,notmuch--version
> + "Version string for this version of Notmuch.")
> + (defconst notmuch-version "unknown"
> + "Placeholder for Notmuch version string. Set during build process.")))
> +)
> +(expand-defconst-notmuch-version)
> +
> (defcustom notmuch-hello-recent-searches-max 10
> "The number of recent searches to display."
> :type 'integer
> @@ -762,7 +774,19 @@ following:
>
> (if no-display
> (set-buffer "*notmuch-hello*")
> - (switch-to-buffer "*notmuch-hello*"))
> + (switch-to-buffer "*notmuch-hello*")
> + (if notmuch-hello-first-run
> + (let ((v (replace-regexp-in-string "^notmuch " ""
> + (car (process-lines notmuch-command
> + "--version")))))
> + (unless (string= v notmuch-version)
> + (save-excursion
> + (erase-buffer)
> + (insert "
> +Notmuch CLI version: " v "
> +Notmuch Emacs version: " notmuch-version "
> +
> +XXX") (y-or-n-p "Press y or n to continue"))))))
>
> (let ((target-line (line-number-at-pos))
> (target-column (current-column))
> --
> 1.8.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI
2013-07-21 8:28 ` Mark Walters
@ 2013-07-21 8:49 ` Tomi Ollila
0 siblings, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2013-07-21 8:49 UTC (permalink / raw)
To: Mark Walters, notmuch
On Sun, Jul 21 2013, Mark Walters <markwalters1009@gmail.com> wrote:
> Hi
>
> I think I would prefer some more specific versioning so that we don't
> have the warning unless we think we might need it. I often run notmuch
> over ssh and the two sides are often minorly out of sync so I think I
> would find a warning each time irritating.
>
> Maybe basing the message on "version + commits since last release" with
> emacs knowing some minimum acceptable version?
Yes... something that is flexible to the user and doesn't cause heavy
maintenance burden to the developers...
BTW we (already?) have this ;)
| Emacs now detects version mismatches with the notmuch CLI
|
| Emacs now detects and reports when the Emacs interface version and
| the notmuch CLI version are incompatible.
(NEWS for notmuch 0.15 -- that relates with --format-version)
>
> Best wishes
>
> Mark
Tomi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-21 8:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17 19:53 [DRAFT PATCH] emacs: notmuch-version and version comparison with CLI Tomi Ollila
2013-07-21 8:28 ` Mark Walters
2013-07-21 8:49 ` Tomi Ollila
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).