emacs: Make the part content available to `mm-inlinable-p'.

The `mm-inlinable-p' function works better if it has access to the
data of the relevant part, so load that content before calling it.

Don't load the content for parts that the user has indicated no desire
to inline.

This fixes the display of attached image/jpeg parts, for example.
This commit is contained in:
David Edmondson 2012-01-19 09:34:07 +00:00 committed by David Bremner
parent e6e10b82c9
commit 63342a3c06

View file

@ -429,14 +429,15 @@ current buffer, if possible."
(with-temp-buffer (with-temp-buffer
(let* ((charset (plist-get part :content-charset)) (let* ((charset (plist-get part :content-charset))
(handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset))))) (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset)))))
(if (and (mm-inlinable-p handle) ;; If the user wants the part inlined, insert the content and
(mm-inlined-p handle)) ;; test whether we are able to inline it (which includes both
(let ((content (notmuch-show-get-bodypart-content msg part nth))) ;; capability and suitability tests).
(insert content) (when (mm-inlined-p handle)
(set-buffer display-buffer) (insert (notmuch-show-get-bodypart-content msg part nth))
(mm-display-part handle) (when (mm-inlinable-p handle)
t) (set-buffer display-buffer)
nil))))) (mm-display-part handle)
t))))))
(defvar notmuch-show-multipart/alternative-discouraged (defvar notmuch-show-multipart/alternative-discouraged
'( '(