-(defun notmuch-show-insert-part-text/* (part content-type depth)
- ;; Handle all text types other than text/html.
- (if (string-equal "text/html" content-type)
- nil
- (notmuch-show-insert-part-header content-type)
- (insert (plist-get part :content))
- t))
-
-(defun notmuch-show-insert-part-*/* (part content-type depth)
- (notmuch-show-insert-part-header content-type)
+(defun notmuch-show-insert-part-application/octet-stream (msg part content-type nth depth declared-type)
+ ;; If we can deduce a MIME type from the filename of the attachment,
+ ;; do so and pass it on to the handler for that type.
+ (if (plist-get part :filename)
+ (let ((extension (file-name-extension (plist-get part :filename)))
+ mime-type)
+ (if extension
+ (progn
+ (mailcap-parse-mimetypes)
+ (setq mime-type (mailcap-extension-to-mime extension))
+ (if (and mime-type
+ (not (string-equal mime-type "application/octet-stream")))
+ (notmuch-show-insert-bodypart-internal msg part mime-type nth depth content-type)
+ nil))
+ nil))))
+
+(defun notmuch-show-insert-part-*/* (msg part content-type nth depth declared-type)
+ ;; This handler _must_ succeed - it is the handler of last resort.
+ (notmuch-show-insert-part-header content-type declared-type (plist-get part :filename))
+ (let ((content (notmuch-show-get-bodypart-content msg part nth)))
+ (if content
+ (notmuch-show-mm-display-part-inline msg part content-type content)))