From 770e07adc06b3274330a935e72f3aa2089791943 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Mon, 3 Aug 2015 09:15:23 +0100 Subject: [PATCH] Re: [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: header --- 53/c75a5f4a664b37634fc4ecf84fca67d133c2ab | 151 ++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 53/c75a5f4a664b37634fc4ecf84fca67d133c2ab diff --git a/53/c75a5f4a664b37634fc4ecf84fca67d133c2ab b/53/c75a5f4a664b37634fc4ecf84fca67d133c2ab new file mode 100644 index 000000000..3eebb4363 --- /dev/null +++ b/53/c75a5f4a664b37634fc4ecf84fca67d133c2ab @@ -0,0 +1,151 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 5FCDD6DE140C + for ; Mon, 3 Aug 2015 01:15:30 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.985 +X-Spam-Level: +X-Spam-Status: No, score=-0.985 tagged_above=-999 required=5 + tests=[AWL=-0.415, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, + DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id IEPqPjDWCqDo for ; + Mon, 3 Aug 2015 01:15:28 -0700 (PDT) +Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com + [209.85.212.169]) + by arlo.cworth.org (Postfix) with ESMTPS id BF5306DE13AB + for ; Mon, 3 Aug 2015 01:15:27 -0700 (PDT) +Received: by wibud3 with SMTP id ud3so102805268wib.0 + for ; Mon, 03 Aug 2015 01:15:26 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type; + bh=0Ovn/Y97JaQVQ4x05Mlcc0jMhdizP27iV4xe7ZRpJZk=; + b=p6cg3re203trcAIIcwU+LA2tOA71bbai4/icZPhC+7UZ/UMrYP/CUrRRfohvbPl1pZ + /5cYGfl6866SVF6BZ9sVkFsWddPa/g00rPZ5BcPpD7mF0Ge7rAvTH/vnxg8lM4HdNvje + si4iUqu21BR2YkPpdg1l4X3G9/1PAt5ilQ19kw9VZxEbPlu+haBp+dQBtJGQzBug4YYs + YcKyWetO3G73+dMmgajKZ6Kv+QKsfkc3ju6sIK74p4wx66vo+SkrlZKeHEVQ9UgEtpiJ + Vt/hzJzP3k28BQn1V1Jo2fcmBsmlf/L83qP3Owy8SL6pyJLWbVFnsAciXpvywYJrT7v8 + R4Vw== +X-Received: by 10.180.83.101 with SMTP id p5mr30593035wiy.52.1438589726022; + Mon, 03 Aug 2015 01:15:26 -0700 (PDT) +Received: from localhost (188.29.71.109.threembb.co.uk. [188.29.71.109]) + by smtp.gmail.com with ESMTPSA id fz16sm12282201wic.3.2015.08.03.01.15.24 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 03 Aug 2015 01:15:25 -0700 (PDT) +From: Mark Walters +To: Tomi Ollila , notmuch@notmuchmail.org, + sojkam1@fel.cvut.cz +Subject: Re: [PATCH 2/2] emacs: prefer notmuch-emacs-version in User-Agent: + header +In-Reply-To: <1438526894-19657-2-git-send-email-tomi.ollila@iki.fi> +References: <1438526894-19657-1-git-send-email-tomi.ollila@iki.fi> + <1438526894-19657-2-git-send-email-tomi.ollila@iki.fi> +User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Mon, 03 Aug 2015 09:15:23 +0100 +Message-ID: <87zj28wzxg.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Mon, 03 Aug 2015 08:15:30 -0000 + + +On Sun, 02 Aug 2015, Tomi Ollila wrote: +> 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. +> --- +> +> Note that I did not create notmuch-guess-emacs-version (or something) +> function. The idea is good but there is one HARD problem: naming it. +> Also, I personally suspect that no-one is going to need that function in +> coming years... + +This pair of patches look good to me +1. + +Best wishes + +Mark + +> +> emacs/notmuch-lib.el | 4 ++++ +> emacs/notmuch-mua.el | 5 ++++- +> emacs/notmuch.el | 4 ---- +> 3 files changed, 8 insertions(+), 5 deletions(-) +> +> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +> index e16a1b9..201d7ec 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 934f6c9..3e52d5e 100644 +> --- a/emacs/notmuch-mua.el +> +++ b/emacs/notmuch-mua.el +> @@ -118,7 +118,10 @@ (defun notmuch-mua-user-agent-full () +> +> (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 6564816..5284e77 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 ") +> -- +> 1.9.3 -- 2.26.2