Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1606D431FAF for ; Fri, 8 Aug 2014 04:20:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JyDH-esi1q0o for ; Fri, 8 Aug 2014 04:19:56 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 9C5EA431FAE for ; Fri, 8 Aug 2014 04:19:55 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 73AEE1000E0; Fri, 8 Aug 2014 14:19:42 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] emacs: prefer notmuch-emacs-version in User-Agent: header Date: Fri, 8 Aug 2014 14:19:41 +0300 Message-Id: <1407496781-17458-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.0.0 Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Aug 2014 11:20:04 -0000 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) -- the function to do that was removed from `notmuch-version' to `notmuch-cli-version' to make things clearer and more consistent. --- NEWS | 14 ++++++++++++++ emacs/notmuch-hello.el | 2 +- emacs/notmuch-lib.el | 4 ++-- emacs/notmuch-mua.el | 11 ++++++++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index f7aaedf91d07..9664146768f3 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,20 @@ Library changes Add return status to notmuch_database_close and notmuch_database_destroy +Emacs Interface +--------------- + +`notmuch-emacs-version` is used in `User-Agent` header + + The value of recently introduced variable `notmuch-emacs-version` is + now used as a part of `User-Agent` header when sending emails. + +Removed `notmuch-version` function by renaming it to `notmuch-cli-version` + + With existing variable `notmuch-emacs-version` the accompanied + function which retrieves the version of `notmuch-command` is + better named as `notmuch-cli-version`. + nmbug-status ------------ diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 65d062760a71..7bfa752d2a04 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 19269e3c469b..ca18ff9d5487 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-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 2c5888600b6c..dbf5df28669d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -100,12 +100,17 @@ (defun notmuch-mua-user-agent-full () " " (notmuch-mua-user-agent-emacs))) +;; the following variable is defined as being defconst in notmuch-version.el +(defvar notmuch-emacs-version) + (defun notmuch-mua-user-agent-notmuch () - "Generate a `User-Agent:' string suitable for notmuch." - (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)")) + "Generate notmuch part of `User-Agent:' string suitable for notmuch." + (concat "Notmuch/" (if (string= notmuch-emacs-version "unknown") + (notmuch-cli-version) + notmuch-emacs-version) " (http://notmuchmail.org)")) (defun notmuch-mua-user-agent-emacs () - "Generate a `User-Agent:' string suitable for notmuch." + "Generate emacs part of `User-Agent:' string suitable for notmuch." (concat "Emacs/" emacs-version " (" system-configuration ")")) (defun notmuch-mua-add-more-hidden-headers () -- 2.0.0