1 Return-Path: <too@guru-group.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 1606D431FAF
\r
6 for <notmuch@notmuchmail.org>; Fri, 8 Aug 2014 04:20:04 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id JyDH-esi1q0o for <notmuch@notmuchmail.org>;
\r
16 Fri, 8 Aug 2014 04:19:56 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 9C5EA431FAE
\r
19 for <notmuch@notmuchmail.org>; Fri, 8 Aug 2014 04:19:55 -0700 (PDT)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 73AEE1000E0; Fri, 8 Aug 2014 14:19:42 +0300 (EEST)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: notmuch@notmuchmail.org
\r
24 Subject: [PATCH] emacs: prefer notmuch-emacs-version in User-Agent: header
\r
25 Date: Fri, 8 Aug 2014 14:19:41 +0300
\r
26 Message-Id: <1407496781-17458-1-git-send-email-tomi.ollila@iki.fi>
\r
27 X-Mailer: git-send-email 2.0.0
\r
28 Cc: tomi.ollila@iki.fi
\r
29 X-BeenThere: notmuch@notmuchmail.org
\r
30 X-Mailman-Version: 2.1.13
\r
32 List-Id: "Use and development of the notmuch mail system."
\r
33 <notmuch.notmuchmail.org>
\r
34 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
35 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
36 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
37 List-Post: <mailto:notmuch@notmuchmail.org>
\r
38 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
39 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
41 X-List-Received-Date: Fri, 08 Aug 2014 11:20:04 -0000
\r
43 Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
\r
44 use that as a part of User-Agent: header to provide more accurate
\r
45 version information when sending emails.
\r
47 In case some incomplete installation of notmuch emacs MUA is used and
\r
48 `notmuch-emacs-version' is defined as "unknown" then fall back to ask
\r
49 version info from cli (as it used to be) -- the function to do that was
\r
50 removed from `notmuch-version' to `notmuch-cli-version' to make things
\r
51 clearer and more consistent.
\r
53 NEWS | 14 ++++++++++++++
\r
54 emacs/notmuch-hello.el | 2 +-
\r
55 emacs/notmuch-lib.el | 4 ++--
\r
56 emacs/notmuch-mua.el | 11 ++++++++---
\r
57 4 files changed, 25 insertions(+), 6 deletions(-)
\r
59 diff --git a/NEWS b/NEWS
\r
60 index f7aaedf91d07..9664146768f3 100644
\r
63 @@ -7,6 +7,20 @@ Library changes
\r
64 Add return status to notmuch_database_close and
\r
65 notmuch_database_destroy
\r
70 +`notmuch-emacs-version` is used in `User-Agent` header
\r
72 + The value of recently introduced variable `notmuch-emacs-version` is
\r
73 + now used as a part of `User-Agent` header when sending emails.
\r
75 +Removed `notmuch-version` function by renaming it to `notmuch-cli-version`
\r
77 + With existing variable `notmuch-emacs-version` the accompanied
\r
78 + function which retrieves the version of `notmuch-command` is
\r
79 + better named as `notmuch-cli-version`.
\r
84 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
85 index 65d062760a71..7bfa752d2a04 100644
\r
86 --- a/emacs/notmuch-hello.el
\r
87 +++ b/emacs/notmuch-hello.el
\r
88 @@ -628,7 +628,7 @@ (defvar notmuch-emacs-version)
\r
89 (defun notmuch-hello-versions ()
\r
90 "Display the notmuch version(s)"
\r
92 - (let ((notmuch-cli-version (notmuch-version)))
\r
93 + (let ((notmuch-cli-version (notmuch-cli-version)))
\r
94 (message "notmuch version %s"
\r
95 (if (string= notmuch-emacs-version notmuch-cli-version)
\r
97 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
98 index 19269e3c469b..ca18ff9d5487 100644
\r
99 --- a/emacs/notmuch-lib.el
\r
100 +++ b/emacs/notmuch-lib.el
\r
101 @@ -192,8 +192,8 @@ (defun notmuch-assert-cli-sane ()
\r
102 "Perhaps you haven't run \"notmuch setup\" yet? Try running this
\r
103 on the command line, and then retry your notmuch command")))
\r
105 -(defun notmuch-version ()
\r
106 - "Return a string with the notmuch version number."
\r
107 +(defun notmuch-cli-version ()
\r
108 + "Return a string with the notmuch-command version number."
\r
110 ;; Trim off the trailing newline.
\r
111 (substring (notmuch-command-to-string "--version") 0 -1)))
\r
112 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
113 index 2c5888600b6c..dbf5df28669d 100644
\r
114 --- a/emacs/notmuch-mua.el
\r
115 +++ b/emacs/notmuch-mua.el
\r
116 @@ -100,12 +100,17 @@ (defun notmuch-mua-user-agent-full ()
\r
118 (notmuch-mua-user-agent-emacs)))
\r
120 +;; the following variable is defined as being defconst in notmuch-version.el
\r
121 +(defvar notmuch-emacs-version)
\r
123 (defun notmuch-mua-user-agent-notmuch ()
\r
124 - "Generate a `User-Agent:' string suitable for notmuch."
\r
125 - (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)"))
\r
126 + "Generate notmuch part of `User-Agent:' string suitable for notmuch."
\r
127 + (concat "Notmuch/" (if (string= notmuch-emacs-version "unknown")
\r
128 + (notmuch-cli-version)
\r
129 + notmuch-emacs-version) " (http://notmuchmail.org)"))
\r
131 (defun notmuch-mua-user-agent-emacs ()
\r
132 - "Generate a `User-Agent:' string suitable for notmuch."
\r
133 + "Generate emacs part of `User-Agent:' string suitable for notmuch."
\r
134 (concat "Emacs/" emacs-version " (" system-configuration ")"))
\r
136 (defun notmuch-mua-add-more-hidden-headers ()
\r