1 Return-Path: <m.walters@qmul.ac.uk>
\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 arlo.cworth.org (Postfix) with ESMTP id 5835E6DE0AA2
\r
6 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 09:14:24 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-1.648 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3,
\r
14 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
\r
15 RP_MATCHES_RCVD=-0.55, T_FREEMAIL_FORGED_FROMDOMAIN=0.01,
\r
16 T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled
\r
17 Received: from arlo.cworth.org ([127.0.0.1])
\r
18 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
19 with ESMTP id PJFknf8HkZ2f for <notmuch@notmuchmail.org>;
\r
20 Sun, 5 Apr 2015 09:14:21 -0700 (PDT)
\r
21 X-Greylist: delayed 1545 seconds by postgrey-1.35 at arlo;
\r
22 Sun, 05 Apr 2015 09:14:20 PDT
\r
23 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
24 by arlo.cworth.org (Postfix) with ESMTPS id C2DCB6DE1A2F
\r
25 for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 09:14:20 -0700 (PDT)
\r
26 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
27 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
28 (envelope-from <m.walters@qmul.ac.uk>)
\r
29 id 1YenBh-0002fJ-N9; Sun, 05 Apr 2015 17:14:18 +0100
\r
30 Received: from 94.197.113.50.threembb.co.uk ([94.197.113.50] helo=localhost)
\r
31 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
32 (envelope-from <m.walters@qmul.ac.uk>)
\r
33 id 1YenBf-0004RY-Hk; Sun, 05 Apr 2015 17:14:17 +0100
\r
34 From: Mark Walters <markwalters1009@gmail.com>
\r
35 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
36 Subject: Re: [PATCH v2] emacs: prefer notmuch-emacs-version in User-Agent:
\r
38 In-Reply-To: <1426932955-23174-1-git-send-email-tomi.ollila@iki.fi>
\r
39 References: <1426932955-23174-1-git-send-email-tomi.ollila@iki.fi>
\r
40 User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1
\r
41 (x86_64-pc-linux-gnu)
\r
42 Date: Sun, 05 Apr 2015 17:14:10 +0100
\r
43 Message-ID: <87lhi61rjh.fsf@qmul.ac.uk>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 X-Sender-Host-Address: 94.197.113.50
\r
47 X-QM-Geographic: According to ripencc,
\r
48 this message was delivered by a machine in Britain (UK) (GB).
\r
49 X-QM-SPAM-Info: Sender has good ham record. :)
\r
50 X-QM-Body-MD5: b1be2c50947868a80d7ad463ba283e8b (of first 20000 bytes)
\r
51 X-SpamAssassin-Score: -0.1
\r
52 X-SpamAssassin-SpamBar: /
\r
53 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
55 spam. We require at least 5.0 points to mark a message as spam.
\r
56 This message scored -0.1 points.
\r
57 Summary of the scoring:
\r
58 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
\r
59 * (markwalters1009[at]gmail.com)
\r
60 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
62 * -0.1 AWL AWL: Adjusted score from AWL reputation of From: address
\r
63 X-QM-Scan-Virus: ClamAV says the message is clean
\r
64 Cc: tomi.ollila@iki.fi
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.18
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Sun, 05 Apr 2015 16:14:24 -0000
\r
80 On Sat, 21 Mar 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
81 > Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA
\r
82 > use that as a part of User-Agent: header to provide more accurate
\r
83 > version information when sending emails.
\r
85 > In case some incomplete installation of notmuch emacs MUA is used and
\r
86 > `notmuch-emacs-version' is defined as "unknown" then fall back to ask
\r
87 > version info from cli (as it used to be) -- the function to do that was
\r
88 > renamed from `notmuch-version' to `notmuch-cli-version' to make this
\r
89 > clearer and more consistent.
\r
91 > The hub of getting version information is new `notmuch-versions'
\r
92 > function. It normally returns cons pair
\r
93 > (notmuch-emacs-version . notmuch-cli-version).
\r
94 > This function takes optional argument which makes the cdr of the return
\r
95 > value work differently; if `notmuch-emacs-version' is "unknown", return
\r
96 > pair as if the option were not given; otherwise return
\r
97 > (notmuch-emacs-version . notmuch-emacs-version).
\r
98 > This special case is useful to simplify setting User-Agent: header
\r
99 > -- just use the cdr of the returned value.
\r
103 At the moment I am not seeing the advantages of this approach over that
\r
104 Michal suggested in id:87oau1un7g.fsf@steelpick.2x.cz (with a
\r
105 notmuch-guess-emacs-version) which looks a little simpler; could you
\r
108 (Just in case its not clear: I like the renaming of notmuch-version to
\r
109 notmuch-cli-version but I feel putting the guessing logic in
\r
110 notmuch-versions with an optional argument is overloading that function,
\r
111 and I am not sure what the advantage of having that function is)
\r
122 > This is v2 of id:1407496781-17458-1-git-send-email-tomi.ollila@iki.fi
\r
124 > (NEWS dropped from this one (for now) -- will arrive later)
\r
126 > emacs/notmuch-hello.el | 13 +++++--------
\r
127 > emacs/notmuch-lib.el | 20 +++++++++++++++++++-
\r
128 > emacs/notmuch-mua.el | 2 +-
\r
129 > emacs/notmuch.el | 4 ----
\r
130 > 4 files changed, 25 insertions(+), 14 deletions(-)
\r
132 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
133 > index 65d0627..62345fe 100644
\r
134 > --- a/emacs/notmuch-hello.el
\r
135 > +++ b/emacs/notmuch-hello.el
\r
136 > @@ -622,18 +622,15 @@ (defun notmuch-hello-window-configuration-change ()
\r
137 > (remove-hook 'window-configuration-change-hook
\r
138 > #'notmuch-hello-window-configuration-change))))
\r
140 > -;; the following variable is defined as being defconst in notmuch-version.el
\r
141 > -(defvar notmuch-emacs-version)
\r
143 > (defun notmuch-hello-versions ()
\r
144 > "Display the notmuch version(s)"
\r
146 > - (let ((notmuch-cli-version (notmuch-version)))
\r
147 > + (let ((notmuch-versions (notmuch-versions)))
\r
148 > (message "notmuch version %s"
\r
149 > - (if (string= notmuch-emacs-version notmuch-cli-version)
\r
150 > - notmuch-cli-version
\r
151 > - (concat notmuch-cli-version
\r
152 > - " (emacs mua version " notmuch-emacs-version ")")))))
\r
153 > + (if (string= (car notmuch-versions) (cdr notmuch-versions))
\r
154 > + (car notmuch-versions)
\r
155 > + (concat (cdr notmuch-versions)
\r
156 > + " (emacs mua version " (car notmuch-versions) ")")))))
\r
158 > (defvar notmuch-hello-mode-map
\r
159 > (let ((map (if (fboundp 'make-composed-keymap)
\r
160 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
161 > index f8e5165..370b648 100644
\r
162 > --- a/emacs/notmuch-lib.el
\r
163 > +++ b/emacs/notmuch-lib.el
\r
164 > @@ -25,6 +25,10 @@
\r
165 > (require 'mm-decode)
\r
168 > +(unless (require 'notmuch-version nil t)
\r
169 > + (defconst notmuch-emacs-version "unknown"
\r
170 > + "Placeholder variable when notmuch-version.el[c] is not available."))
\r
172 > (autoload 'notmuch-jump-search "notmuch-jump"
\r
173 > "Jump to a saved search by shortcut key." t)
\r
175 > @@ -192,7 +196,7 @@ (defun notmuch-assert-cli-sane ()
\r
176 > "Perhaps you haven't run \"notmuch setup\" yet? Try running this
\r
177 > on the command line, and then retry your notmuch command")))
\r
179 > -(defun notmuch-version ()
\r
180 > +(defun notmuch-cli-version ()
\r
181 > "Return a string with the notmuch version number."
\r
182 > (let ((long-string
\r
183 > ;; Trim off the trailing newline.
\r
184 > @@ -202,6 +206,20 @@ (defun notmuch-version ()
\r
185 > (match-string 2 long-string)
\r
188 > +(defun notmuch-versions (&optional cdr-as-emacs-version-unless-unknown)
\r
189 > + "Returns cons pair (notmuch-emacs-version . (`notmuch-cli-version'))
\r
190 > +If optional argument CDR-AS-EMACS-VERSION-UNLESS-UNKNOWN is non-nil
\r
191 > +and `notmuch-emacs-version' is not \"unknown\" return cons pair
\r
192 > +(notmuch-emacs-version . notmuch-emacs-version).
\r
193 > +`notmuch-mua-user-agent-notmuch' utilizes this option, and uses the cdr
\r
194 > +of this cons pair in User-Agent: header"
\r
196 > + (cons notmuch-emacs-version
\r
197 > + (if (or (not cdr-as-emacs-version-unless-unknown)
\r
198 > + (string= notmuch-emacs-version "unknown"))
\r
199 > + (notmuch-cli-version)
\r
200 > + notmuch-emacs-version)))
\r
202 > (defun notmuch-config-get (item)
\r
203 > "Return a value from the notmuch configuration."
\r
204 > (let* ((val (notmuch-command-to-string "config" "get" item))
\r
205 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
206 > index 33f1399..ac067f2 100644
\r
207 > --- a/emacs/notmuch-mua.el
\r
208 > +++ b/emacs/notmuch-mua.el
\r
209 > @@ -118,7 +118,7 @@ (defun notmuch-mua-user-agent-full ()
\r
211 > (defun notmuch-mua-user-agent-notmuch ()
\r
212 > "Generate a `User-Agent:' string suitable for notmuch."
\r
213 > - (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)"))
\r
214 > + (concat "Notmuch/" (cdr (notmuch-versions t)) " (http://notmuchmail.org)"))
\r
216 > (defun notmuch-mua-user-agent-emacs ()
\r
217 > "Generate a `User-Agent:' string suitable for notmuch."
\r
218 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
219 > index ab00454..0cae117 100644
\r
220 > --- a/emacs/notmuch.el
\r
221 > +++ b/emacs/notmuch.el
\r
222 > @@ -61,10 +61,6 @@
\r
223 > (require 'notmuch-message)
\r
224 > (require 'notmuch-parser)
\r
226 > -(unless (require 'notmuch-version nil t)
\r
227 > - (defconst notmuch-emacs-version "unknown"
\r
228 > - "Placeholder variable when notmuch-version.el[c] is not available."))
\r
230 > (defcustom notmuch-search-result-format
\r
231 > `(("date" . "%12s ")
\r
232 > ("count" . "%-7s ")
\r
236 > _______________________________________________
\r
237 > notmuch mailing list
\r
238 > notmuch@notmuchmail.org
\r
239 > http://notmuchmail.org/mailman/listinfo/notmuch
\r