aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2015-08-02 17:48:14 +0300
committerDavid Bremner <david@tethera.net>2015-08-04 20:56:38 +0200
commit3c1eea5646fcf33d66acb874d82f3518a75c24de (patch)
treea05eb83bdeff7e4d9cb8cd74e4a8691497f6808f
parent0c565fa29fc29f74209d4343e2fc88f3b8008aaa (diff)
emacs: prefer notmuch-emacs-version in User-Agent: header
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.
-rw-r--r--emacs/notmuch-lib.el4
-rw-r--r--emacs/notmuch-mua.el5
-rw-r--r--emacs/notmuch.el4
3 files changed, 8 insertions, 5 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index e16a1b97..201d7ec8 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 934f6c95..3e52d5e2 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -118,7 +118,10 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
(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 6564816f..5284e771 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 ")