From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D1762431FAF for ; Thu, 19 Jan 2012 01:34:13 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fFADe6XP9Qdl for ; Thu, 19 Jan 2012 01:34:13 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 0823A431FAE for ; Thu, 19 Jan 2012 01:34:12 -0800 (PST) Received: by wgbdt12 with SMTP id dt12so683906wgb.2 for ; Thu, 19 Jan 2012 01:34:11 -0800 (PST) Received: by 10.180.102.169 with SMTP id fp9mr42514701wib.9.1326965651902; Thu, 19 Jan 2012 01:34:11 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id eb2sm27042459wib.0.2012.01.19.01.34.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Jan 2012 01:34:11 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id CFC9C9FE3F; Thu, 19 Jan 2012 09:34:08 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Make the part content available to `mm-inlinable-p'. Date: Thu, 19 Jan 2012 09:34:07 +0000 Message-Id: <1326965647-1222-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 In-Reply-To: <87k44o6o6e.fsf@gmail.com> References: <87k44o6o6e.fsf@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jan 2012 09:34:14 -0000 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@hotblack-desiato.hh.sledj.net". 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