diff options
-rw-r--r-- | piem-gnus.el | 4 | ||||
-rw-r--r-- | piem-notmuch.el | 4 | ||||
-rw-r--r-- | piem.el | 5 |
3 files changed, 9 insertions, 4 deletions
diff --git a/piem-gnus.el b/piem-gnus.el index 237eeb1..c1551ce 100644 --- a/piem-gnus.el +++ b/piem-gnus.el @@ -69,8 +69,8 @@ message itself if it looks like a patch." (delq nil (mapcar (lambda (handle) (and (listp handle) - (member (mm-handle-media-type handle) - '("text/x-diff" "text/x-patch")) + (piem-am-patch-attachment-p + (mm-handle-media-type handle)) (with-temp-buffer (mm-display-inline handle) (buffer-substring-no-properties diff --git a/piem-notmuch.el b/piem-notmuch.el index cd3153a..ccfae75 100644 --- a/piem-notmuch.el +++ b/piem-notmuch.el @@ -91,8 +91,8 @@ message itself if it looks like a patch." (let ((patches (delq nil (mapcar (lambda (part) - (and (member (plist-get part :content-type) - '("text/x-diff" "text/x-patch")) + (and (piem-am-patch-attachment-p + (plist-get part :content-type)) (plist-get part :content))) (plist-get body :content))))) (when patches @@ -561,6 +561,11 @@ This function depends on :url being configured for entries in ;;;; Patch handling +(defun piem-am-patch-attachment-p (type) + "Return non-nil if an attachment should be treated as a patch. +TYPE is a media type such as \"text/x-patch\"." + (member type '("text/x-diff" "text/x-patch"))) + (defun piem-extract-mbox-info (&optional buffer) "Collect information from message in BUFFER. If BUFFER is nil, the current buffer is used. Any message after |