From: David Edmondson Date: Fri, 29 Jan 2016 17:27:00 +0000 (+0000) Subject: [PATCH v2] Allow content preference based on message content. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c8b170afc9eb726a3e1d917a8a2a07ee3190a2ec;p=notmuch-archives.git [PATCH v2] Allow content preference based on message content. --- diff --git a/0c/41a9dd18b2e9a1ef8305f1073ec08dc05c3404 b/0c/41a9dd18b2e9a1ef8305f1073ec08dc05c3404 new file mode 100644 index 000000000..07548da92 --- /dev/null +++ b/0c/41a9dd18b2e9a1ef8305f1073ec08dc05c3404 @@ -0,0 +1,112 @@ +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 33F9D6DE1607 + for ; Fri, 29 Jan 2016 09:27:10 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.359 +X-Spam-Level: +X-Spam-Status: No, score=0.359 tagged_above=-999 required=5 tests=[AWL=0.426, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, + RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, + UNPARSEABLE_RELAY=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 eUIOqN2n5Rc3 for ; + Fri, 29 Jan 2016 09:27:06 -0800 (PST) +Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com + [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 9ED416DE009A for + ; Fri, 29 Jan 2016 09:27:06 -0800 (PST) +Received: by mail-wm0-f67.google.com with SMTP id p63so11099933wmp.1 + for ; Fri, 29 Jan 2016 09:27:06 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=dme-org.20150623.gappssmtp.com; s=20150623; + h=from:to:subject:date:message-id; + bh=r/5v2XvnH7kdeX0im8ajlcPe0YMpi1oeVR30jxL20ws=; + b=wUrQYac6ba9gRJa3i771FMb+iEPpS2Z6vbIC8RRqD0JPf3v/6tQ3XmjRVAD+ZadlgP + absxaLlW4ll+4IVZeJG6gyhhDKbQYOCW+ro8GVk6N2fWEfcEW4293rTSnn/AOuXC3EXF + qalRnc75pv2UWVkVPF8irHBeKLfVBF8ojgOYpmw1zaTdW7RrEqbgLEEzaDXJRqvSNSY+ + vRsuet7onE6itbOaFrzkuVygyTqXcZM62Ib0NhSslUavXe7adU+qLvNtvW0bg6BxnNLt + DV1aAvvyeVOSW8kTvg8klyR3xbuqiDC3K1VzIvMuphO6g/vLASZ9nuMuXrlyCYHO7pLI + 1lgg== +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:date:message-id; + bh=r/5v2XvnH7kdeX0im8ajlcPe0YMpi1oeVR30jxL20ws=; + b=VwcmcPM+Q2iepN3Cnh4utXzsw7R6TDRTaF43wyrYUxPKaQ/lpOr3eYnQ9M3NNGmNyE + 17HVsNvv9nw2qjyOfJZpsG17Z9iTLgnoDU4Z6igVyiL0uAPDngonGzZ5ptwBMdj7IMiP + CCD543VcfLdvEmARVsJZBl8WBYqMRNMt0dv+9DzRWGVGqmkzJPwlf1xC6n+L3kWCVsJ+ + 48IypulXNigQkl7g9SNjyilSaSA6Ynwj+u/Zgakw3Sflnd1jJegRCdPPqupA0oQ1IoRR + uubwAy2h3wLoBF8XZ7gJLjq8BtgdBOZjxhSRNLi9iBmlUnLzYNWvxFbvR5ksJaMJC+0g + abVw== +X-Gm-Message-State: + AG10YOT60eMlndi9nyam/5Bsgknx0mr+YdbvXwJm13e3D+vPmHRPDQnisje0kDlWHvt7qg== +X-Received: by 10.28.175.147 with SMTP id y141mr9779642wme.64.1454088424630; + Fri, 29 Jan 2016 09:27:04 -0800 (PST) +Received: from disaster-area.hh.sledj.net + ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) + by smtp.gmail.com with ESMTPSA id e9sm16533897wja.25.2016.01.29.09.27.02 + for + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Fri, 29 Jan 2016 09:27:03 -0800 (PST) +Received: from localhost (disaster-area.hh.sledj.net [local]) + by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 7e6677fb + for ; Fri, 29 Jan 2016 17:27:02 +0000 (UTC) +From: David Edmondson +To: notmuch@notmuchmail.org +Subject: [PATCH v2] Allow content preference based on message content. +Date: Fri, 29 Jan 2016 17:27:00 +0000 +Message-Id: <1454088421-6081-1-git-send-email-dme@dme.org> +X-Mailer: git-send-email 2.6.3 +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: Fri, 29 Jan 2016 17:27:10 -0000 + + +Allow content preference based on message content. + +An example configuration might be: + + (defun dme:determine-discouraged (msg) + (let* ((headers (plist-get msg :headers)) + (from (plist-get headers :From))) + (cond + ((string-match "9195404@capita-intouch.co.uk" from) + '("text/plain")) + (t + '("text/html" "multipart/related"))))) + + (setq notmuch-multipart/alternative-discouraged + 'dme:determine-discouraged) + +This would discourage text/html and multipart/related generally, but +discourage text/plain should the message be sent from +9195404@capita-intouch.co.uk. + +v2: +- Remove the simple evaluation variant based on feedback. + + +David Edmondson (1): + emacs: Allow part preferences to depend on message content. + + emacs/notmuch-lib.el | 20 ++++++++++++++++---- + emacs/notmuch-mua.el | 2 +- + emacs/notmuch-show.el | 2 +- + 3 files changed, 18 insertions(+), 6 deletions(-) + +-- +2.6.3 +