[PATCH v2] Allow content preference based on message content.
authorDavid Edmondson <dme@dme.org>
Fri, 29 Jan 2016 17:27:00 +0000 (17:27 +0000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:20:57 +0000 (16:20 -0700)
0c/41a9dd18b2e9a1ef8305f1073ec08dc05c3404 [new file with mode: 0644]

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