1 Return-Path: <amdragon@mit.edu>
\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 92CB6431FBC
\r
6 for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 11:22:04 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 6p8yc4dv9lPu for <notmuch@notmuchmail.org>;
\r
16 Wed, 18 Jan 2012 11:22:04 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 18B9D431FAE
\r
20 for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 11:22:04 -0800 (PST)
\r
21 X-AuditID: 12074425-b7f4a6d0000008e0-b2-4f171bdb17a9
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 4E.91.02272.BDB171F4; Wed, 18 Jan 2012 14:22:03 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q0IJM3Xo018185;
\r
27 Wed, 18 Jan 2012 14:22:03 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0IJM2LV017562
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Wed, 18 Jan 2012 14:22:03 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1Rnb4t-0001a5-W5; Wed, 18 Jan 2012 14:21:48 -0500
\r
37 Date: Wed, 18 Jan 2012 14:21:47 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH v3] Make buttons for attachments allow viewing as well as
\r
42 Message-ID: <20120118192147.GF16740@mit.edu>
\r
43 References: <87lip5rj43.fsf@qmul.ac.uk>
\r
44 <1326843886-18387-1-git-send-email-markwalters1009@gmail.com>
\r
45 <20120117235318.GZ16740@mit.edu> <87ipk9rgg9.fsf@qmul.ac.uk>
\r
46 <20120118012539.GA16740@mit.edu> <87fwfdqoev.fsf@qmul.ac.uk>
\r
48 Content-Type: text/plain; charset=us-ascii
\r
49 Content-Disposition: inline
\r
50 In-Reply-To: <87fwfdqoev.fsf@qmul.ac.uk>
\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
52 X-Brightmail-Tracker:
\r
53 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT170tLe5v0HZV3WL1XB6L6zdnMjsw
\r
54 eeycdZfd49mqW8wBTFFcNimpOZllqUX6dglcGRMfdrMUzOav6Ln7nbGBcQl3FyMnh4SAicT2
\r
55 KyeYIGwxiQv31rN1MXJxCAnsY5Tonj6JHcLZwCjR0beBFcI5ySQxa00jE4SzhFFi252v7CD9
\r
56 LAKqElsfnWEEsdkENCS27V8OZosI6EjcPrQArIZZQFri2+9msH3CAmESX5u3M4PYvEA13Q1v
\r
57 oYa+ZJTo+jGbBSIhKHFy5hMWiGYtiRv/XgIVcYANWv6PA8TkBNq19UcwSIWogIrElJPb2CYw
\r
58 Cs1C0jwLSfMshOYFjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdC30cjNL9FJTSjcxgsPaRXUH
\r
59 44RDSocYBTgYlXh4I0TE/YVYE8uKK3MPMUpyMCmJ8nqIA4X4kvJTKjMSizPii0pzUosPMUpw
\r
60 MCuJ8H7hA8rxpiRWVqUW5cOkpDlYlMR5NbXe+QkJpCeWpGanphakFsFkZTg4lCR4w4HxKyRY
\r
61 lJqeWpGWmVOCkGbi4AQZzgM0XAWkhre4IDG3ODMdIn+KUVFKnNccJCEAksgozYPrhaWdV4zi
\r
62 QK8I81qCVPEAUxZc9yugwUxAgz2axEAGlyQipKQaGAsk+90dVt3wLr5hNXmXidOJvu3B61kM
\r
63 It/deDkxttvCyLLx2J+An4v+vcg1Xy22anKNlFpk749QTg+lDfs0r/t9aDL5sbHe50u2RCd3
\r
64 zY+rLdd/VnQzWmZ2PAu/oyZaJJN/uMnD8Ma8hI9W0YUPjy7wWvddUOJB4qN9X3b7njIVnnll
\r
65 u0rZYiWW4oxEQy3mouJEAJkqMqEWAwAA
\r
66 Cc: notmuch@notmuchmail.org
\r
67 X-BeenThere: notmuch@notmuchmail.org
\r
68 X-Mailman-Version: 2.1.13
\r
70 List-Id: "Use and development of the notmuch mail system."
\r
71 <notmuch.notmuchmail.org>
\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
75 List-Post: <mailto:notmuch@notmuchmail.org>
\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
78 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
79 X-List-Received-Date: Wed, 18 Jan 2012 19:22:04 -0000
\r
81 Quoth Mark Walters on Jan 18 at 10:46 am:
\r
83 > > > +(defun notmuch-show-view-part (message-id nth &optional filename content-type )
\r
84 > > > + (notmuch-with-temp-part-buffer message-id nth
\r
85 > > > + ;; set mm-inlined-types to nil to force an external viewer
\r
86 > > > + (let ((handle (mm-make-handle (current-buffer) (list content-type)))
\r
87 > > > + (mm-inlined-types nil))
\r
88 > > > + ;; We override mm-save-part as notmuch-show-save-part is better
\r
89 > > > + ;; since it offers the filename
\r
90 > > > + (flet ((mm-save-part (&rest args) (ignore)))
\r
91 > > > + (or (mm-display-part handle)
\r
92 > > > + (notmuch-show-save-part message-id nth filename content-type))))))
\r
94 > > > Is that a reasonable solution?
\r
96 > > It's *probably* safe to depend on the result of mm-display-part, but
\r
97 > > you can avoid the question altogether by simply calling
\r
98 > > notmuch-show-save-part from your flet mm-save-part. E.g.,
\r
100 > > (flet ((mm-save-part (&rest args) (notmuch-show-save-part
\r
101 > > message-id nth filename content-type)))
\r
102 > > (mm-display-part handle))
\r
104 > Unfortunately that does not work since mm-display-part has a local
\r
105 > variable "filename". I could copy the variables to some notmuch
\r
106 > prefixed variables but maybe there is some obvious "quoting" to avoid
\r
107 > the problem? (I can't easily check now as the gnu site is closed for the
\r
110 Arrrg, dynamic scoping. Well, you can
\r
112 ;; Lexically bind everything we need in mm-save-part to prevent
\r
113 ;; potential dynamic shadowing.
\r
114 (lexical-let ((message-id message-id)
\r
116 (filename filename)
\r
117 (content-type content-type))
\r
118 (flet ((mm-save-part (&rest args) (notmuch-show-save-part
\r
119 message-id nth filename content-type)))
\r
120 (mm-display-part handle)))
\r
122 Or you could just, y'know, do what were doing.
\r