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

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Thu Jan 19 01:37:33 PST 2012


[and again with reply to all]

On Thu, 19 Jan 2012 09:34:07 +0000, David Edmondson <dme at dme.org> wrote:
> 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.
> ---
> 
> Updated as described in id:"cunboq06szv.fsf at hotblack-desiato.hh.sledj.net".
> 

Looks good to me.

Regards,
  Dmitry

>  emacs/notmuch-show.el |   17 +++++++++--------
>  1 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 2df8d3b..7e9c9b4 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -330,14 +330,15 @@ current buffer, if possible."
>      (with-temp-buffer
>        (let* ((charset (plist-get part :content-charset))
>  	     (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset)))))
> -	(if (and (mm-inlinable-p handle)
> -		 (mm-inlined-p handle))
> -	    (let ((content (notmuch-show-get-bodypart-content msg part nth)))
> -	      (insert content)
> -	      (set-buffer display-buffer)
> -	      (mm-display-part handle)
> -	      t)
> -	  nil)))))
> +	;; If the user wants the part inlined, insert the content and
> +	;; test whether we are able to inline it (which includes both
> +	;; capability and suitability tests).
> +	(when (mm-inlined-p handle)
> +	  (insert (notmuch-show-get-bodypart-content msg part nth))
> +	  (when (mm-inlinable-p handle)
> +	    (set-buffer display-buffer)
> +	    (mm-display-part handle)
> +	    t))))))
>  
>  (defvar notmuch-show-multipart/alternative-discouraged
>    '(
> -- 
> 1.7.8.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list