From 4c9a8ea1121655511ff2a4a6e5aa14be7bd334f0 Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 12 Feb 2017 11:33:01 +0200 Subject: [PATCH] mu4e: filter out body parts as attachments Make the attachment heuristic yet a bit more complicated... filter out most body parts. --- mu4e/mu4e-view.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 2ab2b4a7..0f154e9c 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -523,6 +523,7 @@ add text-properties to VAL." (setq mu4e~view-attach-map ;; buffer local (make-hash-table :size 64 :weakness nil)) (let* ((id 0) + (partcount (length (mu4e-message-field msg :parts))) (attachments ;; we only list parts that look like attachments, ie. that have a ;; non-nil :attachment property; we record a mapping between @@ -540,9 +541,13 @@ add text-properties to VAL." ;; list inline parts as attachment (so they can be ;; saved), unless they are text/plain, which are ;; usually just message footers in mailing lists + ;; + ;; however, slow bigger text parts as attachments, + ;; except when they're the only part... it's + ;; complicated. (and (member 'inline attachtype) (or - (> partsize 256) ;; filter out footers + (and (> partcount 1) (> partsize 256)) (not (string-match "^text/plain" mtype))))))) (or ;; remove if it's not an attach *or* if it's an ;; image/audio/application type (but not a signature)