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