Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 972B2429E5F for ; Tue, 17 Jan 2012 15:42:10 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 1dXu4ThyRh5l for ; Tue, 17 Jan 2012 15:42:10 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E06EB429E27 for ; Tue, 17 Jan 2012 15:42:09 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1RnIfE-0003cg-VL; Tue, 17 Jan 2012 23:42:05 +0000 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1RnIfE-0006Nc-N1; Tue, 17 Jan 2012 23:42:04 +0000 From: Mark Walters To: Austin Clements Subject: Re: [PATCH 1/1] Make buttons for attachments allow viewing as well as saving In-Reply-To: <20120117230255.GW16740@mit.edu> References: <1326629796-11436-1-git-send-email-markwalters1009@gmail.com> <1326629796-11436-2-git-send-email-markwalters1009@gmail.com> <87wr8r5trv.fsf@servo.finestructure.net> <87lip7fhkc.fsf@qmul.ac.uk> <20120117022330.GE16740@mit.edu> <8739beitq4.fsf@qmul.ac.uk> <20120117202603.GP16740@mit.edu> <871uqy3vy4.fsf@qmul.ac.uk> <20120117210158.GS16740@mit.edu> <87obu2q80o.fsf@qmul.ac.uk> <20120117230255.GW16740@mit.edu> User-Agent: Notmuch/0.11~rc2+73~g1ea2b60 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Tue, 17 Jan 2012 23:42:52 +0000 Message-ID: <87lip5rj43.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 94.192.233.223 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: ac6e21fbaa3487fcfec61851dc6f910d (of first 20000 bytes) X-SpamAssassin-Score: -1.8 X-SpamAssassin-SpamBar: - X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -1.8 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay * domain * 0.6 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean Cc: notmuch@notmuchmail.org 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: Tue, 17 Jan 2012 23:42:10 -0000 > > Oops, actually there was a bug in that macro. It should have been > > (defmacro notmuch-with-temp-part-buffer (message-id nth &rest body) > (declare (indent 2)) > (let ((process-crypto (make-symbol "process-crypto"))) > `(let ((,process-crypto notmuch-show-process-crypto)) > (with-temp-buffer > (setq notmuch-show-process-crypto ,process-crypto) > ;; Always acquires the part via `notmuch part', even if it is > ;; available in the JSON output. > (insert (notmuch-show-get-bodypart-internal ,message-id ,nth)) > ,@body)))) > > The only difference is on the "insert" line. Sorry about that. Fixed. [Snip excellent explanation of defmacro] Thanks for the excellent explanation! > > Finally, I have discovered one bug/misfeature. If you try to "view" an > > attachment then it will offer to save it but will not offer a > > filename. If you try and save it (or use the default action) it will > > offer a filename as now. As far as I can see this is not fixable if I > > use mm-display-part: however, I could include a slight tweaked version, > > notmuch-show-mm-display-part say, which would fix this corner > > case. (Essentially, it would call notmuch-show-save-part if it failed to > > find a handler rather than mailcap-save-binary-file.) However, this is > > about 50 lines of lisp so I am not sure it is worth it. > > Hmm. This is probably worth fixing, but probably in a separate patch. > Duplicating mm-display-part is probably not the way to go. It think > it will work to pass t as the no-default argument to mm-display-part > and check the return value, which should be 'inline if it was able to > handle it internally or 'external if it found an external helper. I'm > pretty sure it will never fall in to mailcap-save-binary-file in that > case. If that doesn't work, you could flet mailcap-save-binary-file > around the call to mm-display-part. I had tried passing t to mm-display-part and that didn't work as I expected. I will experiment some more and try your flet suggestion but I think that will be a separate patch. I will send a potential final version of this patch as a reply to this email. Many thanks for all the guidance and help! Best wishes Mark