Re: [PATCH v1] emacs: Allow part preferences to depend on message content.
authorAaron Ecay <aaronecay@gmail.com>
Tue, 19 Jan 2016 13:41:34 +0000 (13:41 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:53 +0000 (16:20 -0700)
99/91b675be86fd38e39dfd08cff72d71741aae8b [new file with mode: 0644]

diff --git a/99/91b675be86fd38e39dfd08cff72d71741aae8b b/99/91b675be86fd38e39dfd08cff72d71741aae8b
new file mode 100644 (file)
index 0000000..ae7b30e
--- /dev/null
@@ -0,0 +1,131 @@
+Return-Path: <aaronecay@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id B22596DE13F4\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 05:41:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.82\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.82 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id U4gasCb40ykx for <notmuch@notmuchmail.org>;\r
+ Tue, 19 Jan 2016 05:41:38 -0800 (PST)\r
+Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com\r
+ [74.125.82.47]) by arlo.cworth.org (Postfix) with ESMTPS id 6D5326DE13CC for\r
+ <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 05:41:38 -0800 (PST)\r
+Received: by mail-wm0-f47.google.com with SMTP id 123so91940097wmz.0\r
+ for <notmuch@notmuchmail.org>; Tue, 19 Jan 2016 05:41:38 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:subject:in-reply-to:references:user-agent:mail-followup-to\r
+ :date:message-id:mime-version:content-type:content-transfer-encoding;\r
+ bh=6B5p/KJP9Zl3bd7n9Dvlz1mRkWqwaLlPRtI0+M9ijIE=;\r
+ b=i2GKeDvrvxmYKJXKcUjmRUNrqb/avNXf0yEHovH9sh9TNKU5+X2cU03EZN/awryC6d\r
+ 3GDyWCt1O1QRpUKfgbs1GNrB1JglcoImcH62kx6EMAc/6w0ufpQ0KHTxKulBlt8yq9rm\r
+ IEoOesYMDKaCfXyEJgKNU8dx4cyVR5nGo1+wu0ODhqkSjS/vl365e3J6xja/pbFGdAH6\r
+ Cm6A+qkRF3ShpneBaI0JeQ3PSyS6J88bzgZGRbqDtUvPptvu3XtQyebU8h1OSRE+xVwf\r
+ /VNykji077jI9629CyZhuxkrZoqX3OgHZn4wLsLyN/qACt4g4Q9gambEggc+dEJQcOJe\r
+ 4SNw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+ :user-agent:mail-followup-to:date:message-id:mime-version\r
+ :content-type:content-transfer-encoding;\r
+ bh=6B5p/KJP9Zl3bd7n9Dvlz1mRkWqwaLlPRtI0+M9ijIE=;\r
+ b=A72IhMjZalo1/j1feFgUowKtuG77JcMhCn3qeJ0oRdD9j57ZUAINU1HTWCCxF0rAb+\r
+ +8e0s3FcqhRrnZY+VSGf9aCOMDrH1Y7aeEfZSIsqPJ9x6zPK5Az5us9Ffo3hMI4UnFjJ\r
+ I3iCgB02pGplXj7ZqcPkLmac+SealHVuRnLRRkk9VtEt5nftaBUKgxm45Hpbypg+T+xP\r
+ i0RlAbcEdNrYDTBQazj2vYAdjKcWw9OZwqVaHDP4i9+7evhzw3VkXLv5PIBL8Pq/vWsW\r
+ 5/55SKJoDsFn0X3mIseX5EU0kwbVHtqy/CyDaKHMq1y6hfahJtL1v7brXETJktORsNF0\r
+ xfrQ==\r
+X-Gm-Message-State:\r
+ AG10YOT1pJLNvhdvUIyCVp2h9XNU0XQ5CbwuzMGi+KPnjHpDn6/SpHT7nVCrOSdXBW5gVw==\r
+X-Received: by 10.28.184.76 with SMTP id i73mr18208613wmf.43.1453210896560;\r
+ Tue, 19 Jan 2016 05:41:36 -0800 (PST)\r
+Received: from localhost (host-92-30-127-241.as13285.net. [92.30.127.241])\r
+ by smtp.gmail.com with ESMTPSA id w8sm28575800wjx.21.2016.01.19.05.41.35\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Tue, 19 Jan 2016 05:41:35 -0800 (PST)\r
+From: Aaron Ecay <aaronecay@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v1] emacs: Allow part preferences to depend on message\r
+ content.\r
+In-Reply-To: <1452864898-9719-2-git-send-email-dme@dme.org>\r
+References: <1452864898-9719-1-git-send-email-dme@dme.org>\r
+ <1452864898-9719-2-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.21+33~g570c0ae (http://notmuchmail.org) Emacs/25.0.50.2\r
+ (x86_64-unknown-linux-gnu)\r
+X-Clacks-Overhead: GNU Terry Pratchett\r
+Mail-Followup-To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Date: Tue, 19 Jan 2016 13:41:34 +0000\r
+Message-ID: <87k2n5hek1.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 19 Jan 2016 13:41:41 -0000\r
+\r
+Hi David,\r
+\r
+2016ko urtarrilak 15an, David Edmondson-ek idatzi zuen:\r
+>=20\r
+> Currently the preference for which sub-part of a multipart/alternative\r
+> part is shown is global. Allow to the user to override the settings on a\r
+> per-message basis by providing two new options:\r
+>=20\r
+>   - the ability to call a function that has access to the message to\r
+>     return the discouraged type list,\r
+>   - a simple evaluation environment to reduce the need for most users to\r
+>     write their own function.\r
+>=20\r
+> The original approach is retained as the default.\r
+> ---\r
+>  emacs/notmuch-lib.el  | 39 +++++++++++++++++++++++++++++++++++----\r
+>  emacs/notmuch-mua.el  |  2 +-\r
+>  emacs/notmuch-show.el |  2 +-\r
+>  3 files changed, 37 insertions(+), 6 deletions(-)\r
+>=20\r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 89c01a5..2b9d108 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -520,11 +520,42 @@ This replaces spaces, percents, and double quotes i=\r
+n STR with\r
+>      "multipart/related"\r
+>      ))\r
+>=20=20\r
+> -(defun notmuch-multipart/alternative-choose (types)\r
+> -  "Return a list of preferred types from the given list of types"\r
+> +(defun notmuch-multipart/alternative-determine-discouraged-1 (msg direct=\r
+ive)\r
+> +  (let* ((headers (plist-get msg :headers))\r
+> +     ;; Headers that we make available:\r
+> +     (from (plist-get headers :From))\r
+> +     (subject (plist-get headers :Subject))\r
+> +     (to (plist-get headers :To))\r
+> +     (cc (plist-get headers :Cc)))\r
+> +\r
+> +    (eval directive)))\r
+\r
+This code is not compatible with lexical binding in emacs >=3D 24, which I\r
+assume notmuch will eventually want to adopt.  What=E2=80=99s so bad about\r
+writing a function?\r
+\r
+--=20\r
+Aaron Ecay\r