[PATCH v2 12/13] show: Convert do_show to use sprinter
[notmuch-archives.git] / 04 / 40c27a2c7bbd8547b8bc52006dc95762e40853
1 Return-Path: <dmitry.kurochkin@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 7689F431FAF\r
6         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 01:38:31 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id q1jSV5CqyIVC for <notmuch@notmuchmail.org>;\r
17         Thu, 19 Jan 2012 01:38:30 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 98A68431FAE\r
22         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 01:38:30 -0800 (PST)\r
23 Received: by bkty12 with SMTP id y12so2545422bkt.26\r
24         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 01:38:29 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=7eXz8qylw5tq+WSowO08Vuh9tcH8WOo9KGFyEwCqIbk=;\r
29         b=UAZuOO6o8ZmyyaWYSuIaCzjAQ4MysZhCemRcnYKGW+X73AaoHVTMeVOLm5fjRls5BX\r
30         G3tRJIfJLvFWBaIsJMdgwnmJ2XNh0mv+bJHzxChUIXB/C6sbnSR6b/jWnF9HQMhlN+lD\r
31         U+pV0qwf0X4TH3ivMWgNDFzRNj29zARh56aC0=\r
32 Received: by 10.204.152.136 with SMTP id g8mr9655924bkw.127.1326965909123;\r
33         Thu, 19 Jan 2012 01:38:29 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id sp6sm37370921bkb.2.2012.01.19.01.38.28\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Thu, 19 Jan 2012 01:38:28 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH] emacs: Make the part content available to\r
41         `mm-inlinable-p'.\r
42 In-Reply-To: <1326965647-1222-1-git-send-email-dme@dme.org>\r
43 References: <87k44o6o6e.fsf@gmail.com>\r
44         <1326965647-1222-1-git-send-email-dme@dme.org>\r
45 User-Agent: Notmuch/0.11+73~g8a5402e (http://notmuchmail.org) Emacs/23.3.1\r
46         (x86_64-pc-linux-gnu)\r
47 Date: Thu, 19 Jan 2012 13:37:33 +0400\r
48 Message-ID: <87boq06nj6.fsf@gmail.com>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Thu, 19 Jan 2012 09:38:31 -0000\r
64 \r
65 [and again with reply to all]\r
66 \r
67 On Thu, 19 Jan 2012 09:34:07 +0000, David Edmondson <dme@dme.org> wrote:\r
68 > The `mm-inlinable-p' function works better if it has access to the\r
69 > data of the relevant part, so load that content before calling it.\r
70\r
71 > Don't load the content for parts that the user has indicated no desire\r
72 > to inline.\r
73\r
74 > This fixes the display of attached image/jpeg parts, for example.\r
75 > ---\r
76\r
77 > Updated as described in id:"cunboq06szv.fsf@hotblack-desiato.hh.sledj.net".\r
78\r
79 \r
80 Looks good to me.\r
81 \r
82 Regards,\r
83   Dmitry\r
84 \r
85 >  emacs/notmuch-show.el |   17 +++++++++--------\r
86 >  1 files changed, 9 insertions(+), 8 deletions(-)\r
87\r
88 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
89 > index 2df8d3b..7e9c9b4 100644\r
90 > --- a/emacs/notmuch-show.el\r
91 > +++ b/emacs/notmuch-show.el\r
92 > @@ -330,14 +330,15 @@ current buffer, if possible."\r
93 >      (with-temp-buffer\r
94 >        (let* ((charset (plist-get part :content-charset))\r
95 >            (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset)))))\r
96 > -     (if (and (mm-inlinable-p handle)\r
97 > -              (mm-inlined-p handle))\r
98 > -         (let ((content (notmuch-show-get-bodypart-content msg part nth)))\r
99 > -           (insert content)\r
100 > -           (set-buffer display-buffer)\r
101 > -           (mm-display-part handle)\r
102 > -           t)\r
103 > -       nil)))))\r
104 > +     ;; If the user wants the part inlined, insert the content and\r
105 > +     ;; test whether we are able to inline it (which includes both\r
106 > +     ;; capability and suitability tests).\r
107 > +     (when (mm-inlined-p handle)\r
108 > +       (insert (notmuch-show-get-bodypart-content msg part nth))\r
109 > +       (when (mm-inlinable-p handle)\r
110 > +         (set-buffer display-buffer)\r
111 > +         (mm-display-part handle)\r
112 > +         t))))))\r
113 >  \r
114 >  (defvar notmuch-show-multipart/alternative-discouraged\r
115 >    '(\r
116 > -- \r
117 > 1.7.8.3\r
118\r
119 > _______________________________________________\r
120 > notmuch mailing list\r
121 > notmuch@notmuchmail.org\r
122 > http://notmuchmail.org/mailman/listinfo/notmuch\r