unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] emacs: renamed function notmuch-version to notmuch-cli-version
@ 2015-08-02 14:48 Tomi Ollila
  2015-08-02 14:48 ` [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header Tomi Ollila
  0 siblings, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2015-08-02 14:48 UTC (permalink / raw)
  To: notmuch, markwalters1009, sojkam1; +Cc: tomi.ollila

As it asks `notmuch` binary for its version number.
---

This is 3rd revision, previous in id:1426932955-23174-1-git-send-email-tomi.ollila@iki.fi

 emacs/notmuch-hello.el | 2 +-
 emacs/notmuch-lib.el   | 4 ++--
 emacs/notmuch-mua.el   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 65d0627..7bfa752 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -628,7 +628,7 @@ (defvar notmuch-emacs-version)
 (defun notmuch-hello-versions ()
   "Display the notmuch version(s)"
   (interactive)
-  (let ((notmuch-cli-version (notmuch-version)))
+  (let ((notmuch-cli-version (notmuch-cli-version)))
     (message "notmuch version %s"
 	     (if (string= notmuch-emacs-version notmuch-cli-version)
 		 notmuch-cli-version
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index f8e5165..e16a1b9 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -192,8 +192,8 @@ (defun notmuch-assert-cli-sane ()
 "Perhaps you haven't run \"notmuch setup\" yet? Try running this
 on the command line, and then retry your notmuch command")))
 
-(defun notmuch-version ()
-  "Return a string with the notmuch version number."
+(defun notmuch-cli-version ()
+  "Return a string with the notmuch cli command version number."
   (let ((long-string
 	 ;; Trim off the trailing newline.
 	 (substring (notmuch-command-to-string "--version") 0 -1)))
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 33f1399..934f6c9 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,7 @@ (defun notmuch-mua-user-agent-full ()
 
 (defun notmuch-mua-user-agent-notmuch ()
   "Generate a `User-Agent:' string suitable for notmuch."
-  (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)"))
+  (concat "Notmuch/" (notmuch-cli-version) " (http://notmuchmail.org)"))
 
 (defun notmuch-mua-user-agent-emacs ()
   "Generate a `User-Agent:' string suitable for notmuch."
-- 
1.9.3

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

* [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header
  2015-08-02 14:48 [PATCH 1/2] emacs: renamed function notmuch-version to notmuch-cli-version Tomi Ollila
@ 2015-08-02 14:48 ` Tomi Ollila
  2015-08-03  8:15   ` Mark Walters
  2015-08-04 18:59   ` David Bremner
  0 siblings, 2 replies; 4+ messages in thread
From: Tomi Ollila @ 2015-08-02 14:48 UTC (permalink / raw)
  To: notmuch, markwalters1009, sojkam1; +Cc: tomi.ollila

Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
use that as a part of User-Agent: header to provide more accurate
version information when sending emails.

In case some incomplete installation of notmuch emacs MUA is used and
`notmuch-emacs-version' is defined as "unknown" then fall back to ask
version info from cli (as it used to be before this commit).

Requiring notmuch-version[.elc] and if that is missing setting
"fallback" notmuch-emacs-version (to "unknown") was moved from
notmuch.el to notmuch-lib.el as notmuch-mua.el (which provides
User-Agent: information) require's the latter.
---

Note that I did not create notmuch-guess-emacs-version (or something)
function. The idea is good but there is one HARD problem: naming it.
Also, I personally suspect that no-one is going to need that function in
coming years...

 emacs/notmuch-lib.el | 4 ++++
 emacs/notmuch-mua.el | 5 ++++-
 emacs/notmuch.el     | 4 ----
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index e16a1b9..201d7ec 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -25,6 +25,10 @@
 (require 'mm-decode)
 (require 'cl)
 
+(unless (require 'notmuch-version nil t)
+  (defconst notmuch-emacs-version "unknown"
+    "Placeholder variable when notmuch-version.el[c] is not available."))
+
 (autoload 'notmuch-jump-search "notmuch-jump"
   "Jump to a saved search by shortcut key." t)
 
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 934f6c9..3e52d5e 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,10 @@ (defun notmuch-mua-user-agent-full ()
 
 (defun notmuch-mua-user-agent-notmuch ()
   "Generate a `User-Agent:' string suitable for notmuch."
-  (concat "Notmuch/" (notmuch-cli-version) " (http://notmuchmail.org)"))
+  (let ((notmuch-version (if (string= notmuch-emacs-version "unknown")
+			     (notmuch-cli-version)
+			   notmuch-emacs-version)))
+    (concat "Notmuch/" notmuch-version " (http://notmuchmail.org)")))
 
 (defun notmuch-mua-user-agent-emacs ()
   "Generate a `User-Agent:' string suitable for notmuch."
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6564816..5284e77 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -61,10 +61,6 @@
 (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.9.3

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

* Re: [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header
  2015-08-02 14:48 ` [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header Tomi Ollila
@ 2015-08-03  8:15   ` Mark Walters
  2015-08-04 18:59   ` David Bremner
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Walters @ 2015-08-03  8:15 UTC (permalink / raw)
  To: Tomi Ollila, notmuch, sojkam1; +Cc: tomi.ollila


On Sun, 02 Aug 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
> use that as a part of User-Agent: header to provide more accurate
> version information when sending emails.
>
> In case some incomplete installation of notmuch emacs MUA is used and
> `notmuch-emacs-version' is defined as "unknown" then fall back to ask
> version info from cli (as it used to be before this commit).
>
> Requiring notmuch-version[.elc] and if that is missing setting
> "fallback" notmuch-emacs-version (to "unknown") was moved from
> notmuch.el to notmuch-lib.el as notmuch-mua.el (which provides
> User-Agent: information) require's the latter.
> ---
>
> Note that I did not create notmuch-guess-emacs-version (or something)
> function. The idea is good but there is one HARD problem: naming it.
> Also, I personally suspect that no-one is going to need that function in
> coming years...

This pair of patches look good to me +1. 

Best wishes

Mark

>
>  emacs/notmuch-lib.el | 4 ++++
>  emacs/notmuch-mua.el | 5 ++++-
>  emacs/notmuch.el     | 4 ----
>  3 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index e16a1b9..201d7ec 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -25,6 +25,10 @@
>  (require 'mm-decode)
>  (require 'cl)
>  
> +(unless (require 'notmuch-version nil t)
> +  (defconst notmuch-emacs-version "unknown"
> +    "Placeholder variable when notmuch-version.el[c] is not available."))
> +
>  (autoload 'notmuch-jump-search "notmuch-jump"
>    "Jump to a saved search by shortcut key." t)
>  
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 934f6c9..3e52d5e 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -118,7 +118,10 @@ (defun notmuch-mua-user-agent-full ()
>  
>  (defun notmuch-mua-user-agent-notmuch ()
>    "Generate a `User-Agent:' string suitable for notmuch."
> -  (concat "Notmuch/" (notmuch-cli-version) " (http://notmuchmail.org)"))
> +  (let ((notmuch-version (if (string= notmuch-emacs-version "unknown")
> +			     (notmuch-cli-version)
> +			   notmuch-emacs-version)))
> +    (concat "Notmuch/" notmuch-version " (http://notmuchmail.org)")))
>  
>  (defun notmuch-mua-user-agent-emacs ()
>    "Generate a `User-Agent:' string suitable for notmuch."
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 6564816..5284e77 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -61,10 +61,6 @@
>  (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.9.3

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

* Re: [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header
  2015-08-02 14:48 ` [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header Tomi Ollila
  2015-08-03  8:15   ` Mark Walters
@ 2015-08-04 18:59   ` David Bremner
  1 sibling, 0 replies; 4+ messages in thread
From: David Bremner @ 2015-08-04 18:59 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

Tomi Ollila <tomi.ollila@iki.fi> writes:

> Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
> use that as a part of User-Agent: header to provide more accurate
> version information when sending emails.
>

pushed.

d

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

end of thread, other threads:[~2015-08-04 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-02 14:48 [PATCH 1/2] emacs: renamed function notmuch-version to notmuch-cli-version Tomi Ollila
2015-08-02 14:48 ` [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header Tomi Ollila
2015-08-03  8:15   ` Mark Walters
2015-08-04 18:59   ` 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).