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