From: David Edmondson Date: Sun, 3 Apr 2016 16:04:37 +0000 (+0100) Subject: [PATCH v3] Allow content preference based on message content. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c092e11efa586ba83709d8e75f2631df6c7042c2;p=notmuch-archives.git [PATCH v3] Allow content preference based on message content. --- diff --git a/95/72bc203d4171fb7e999daa4ea38d839f47f5a6 b/95/72bc203d4171fb7e999daa4ea38d839f47f5a6 new file mode 100644 index 000000000..544735c9a --- /dev/null +++ b/95/72bc203d4171fb7e999daa4ea38d839f47f5a6 @@ -0,0 +1,118 @@ +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 B29AB6DE02C9 + for ; Sun, 3 Apr 2016 09:04:51 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.166 +X-Spam-Level: +X-Spam-Status: No, score=-0.166 tagged_above=-999 required=5 + tests=[AWL=-0.099, 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 FN2v-1jDnmOi for ; + Sun, 3 Apr 2016 09:04:43 -0700 (PDT) +Received: from mail-lb0-f193.google.com (mail-lb0-f193.google.com + [209.85.217.193]) + by arlo.cworth.org (Postfix) with ESMTPS id 1EA2F6DE0159 + for ; Sun, 3 Apr 2016 09:04:43 -0700 (PDT) +Received: by mail-lb0-f193.google.com with SMTP id vk4so17542234lbb.1 + for ; Sun, 03 Apr 2016 09:04:43 -0700 (PDT) +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=hs2+c7+ittloHbrCI7LyEvlOjwlNMaLEMSlwazQ1T6c=; + b=wv3PdNpmM4v16JutHnUzftWEcWiZvUVxkWI7wGROQCfBuDVR0RLwsmxFnyQR7jbEPk + 6iz6v3Eh7wfwiENLtAkaHg87FTxCdFvhUoOb8tKWHlLMvRifg4lnu6Dho1QXEuCz2/JM + nv6NLZhByRrWSabiJaMETtaW5BL3H0YDL393/W3YFf+E+9f6lMo+93Fxw7VzorptG3ew + JdRrYgwPoXYFOIlqhRrKUHzrXFfFLscMmgvh/kgO7HxFF9tOkBj2WokIwGQvCk5M3TRe + yU4myUjPShlj35nRc7/+XD7MBY3AaRgq7nQ1Bgyq1gZBDLQbp52KV88ARLQEWNsZ/39z + ZBjw== +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=hs2+c7+ittloHbrCI7LyEvlOjwlNMaLEMSlwazQ1T6c=; + b=cQdZhli/TRDw6Solt+uJDs/VuMPVQIyZ7NIDMiBQdzD5D0l7J5v2k0jjELaRnIZN9W + amsHAYH+CObb/NoelQTepokr1zI289Tqvb5o5h+Yyi/KF74DnqF9xkokg56/zXXaSuBh + VEjWNM5TqBZkiPx4y/bmt43jEWw+ANZD0CrTfWf1mpPQsd4m8QgaEwdoRxEXo64fdxiI + tWzbQYaZYcT2R4xwuLnNSNoCrKh9mJSouMCyJgmQtPP1JogIzVloHu2/BvYQgBLAkGk8 + WrIibXgUv2AcK5el8IF8QpDIa4/ExowpCgvCNdsALyWqAZ1muz5t1gACFGW+KYOORXh7 + +ITQ== +X-Gm-Message-State: + AD7BkJKyomXbLv2XrV+BDLHVdN8T781mw2gUiua79gpMLCiEfjo5d/CS7LLiL2cTYoVAoA== +X-Received: by 10.28.136.211 with SMTP id k202mr8055209wmd.93.1459699481369; + Sun, 03 Apr 2016 09:04:41 -0700 (PDT) +Received: from disaster-area.hh.sledj.net + ([2a01:348:1a2:1:ea39:35ff:fe2c:a227]) + by smtp.gmail.com with ESMTPSA id gk4sm24351438wjd.7.2016.04.03.09.04.39 + for + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 03 Apr 2016 09:04:39 -0700 (PDT) +Received: from localhost (disaster-area.hh.sledj.net [local]) + by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 47376ba4 + for ; Sun, 3 Apr 2016 16:04:38 +0000 (UTC) +From: David Edmondson +To: notmuch@notmuchmail.org +Subject: [PATCH v3] Allow content preference based on message content. +Date: Sun, 3 Apr 2016 17:04:37 +0100 +Message-Id: <1459699478-21167-1-git-send-email-dme@dme.org> +X-Mailer: git-send-email 2.1.4 +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: Sun, 03 Apr 2016 16:04:51 -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 (or (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. + +v3: +- Merge forward. +- Update the example to allow for a nil msg (which should no longer + happen, but it's good to be safe). + + +David Edmondson (1): + emacs: Allow part preferences to depend on message content. + + emacs/notmuch-lib.el | 20 ++++++++++++++++---- + emacs/notmuch-show.el | 2 +- + 2 files changed, 17 insertions(+), 5 deletions(-) + +-- +2.1.4 +