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 9B779431FB6 for ; Sun, 26 May 2013 00:05:12 -0700 (PDT) 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 DpCNB63-pF4h for ; Sun, 26 May 2013 00:05:05 -0700 (PDT) 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 CC99B431FAE for ; Sun, 26 May 2013 00:05:04 -0700 (PDT) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1UgV0m-0006KM-Bo; Sun, 26 May 2013 08:05:00 +0100 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) (envelope-from ) id 1UgV0m-0005Mi-1O; Sun, 26 May 2013 08:05:00 +0100 From: Mark Walters To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH v2] emacs: Don't override mm-show-part in notmuch-show-view-part In-Reply-To: <1369550086-26986-1-git-send-email-amdragon@mit.edu> References: <8761ycc19t.fsf@qmul.ac.uk> <1369550086-26986-1-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sun, 26 May 2013 08:04:59 +0100 Message-ID: <874ndq2pd0.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 01b4158ce91d9743d5449e3aa5bc2201 (of first 20000 bytes) X-SpamAssassin-Score: -0.1 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 -0.1 points. Summary of the scoring: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.1 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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: Sun, 26 May 2013 07:05:13 -0000 LGTM +1 This does not rely on the followup Austin mentioned in id:20130526063627.GQ5999@mit.edu is so I think this should go in as is as it fixes the flet thing without changing the behaviour. Best wishes Mark On Sun, 26 May 2013, Austin Clements wrote: > Previously, notmuch-show-view-part overrode the function binding of > mm-show-part to redirect it to notmuch-show-save-part to get notmuch's > default file name handling in case mm-display-part decided to fall > back to saving the part. In addition to being messy, this depended on > the now-deprecated dynamic binding behavior of flet. > > This patch removes the mm-show-part override in favor of passing the > file name in to mm-show-part the way it expects, so we get its default > file name handling. It's not clear why we didn't do this before; > mm-show-part has supported default file names since at least Emacs > 23.1. > --- > This version overrides the default save directory to make it > consistent with `notmuch-show-save-part'. > > emacs/notmuch-show.el | 23 +++++++++-------------- > 1 file changed, 9 insertions(+), 14 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 423dd58..d773396 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -528,20 +528,15 @@ message at DEPTH in the current thread." > > (defun notmuch-show-view-part (message-id nth &optional filename content-type ) > (notmuch-with-temp-part-buffer message-id nth > - ;; set mm-inlined-types to nil to force an external viewer > - (let ((handle (mm-make-handle (current-buffer) (list content-type))) > - (mm-inlined-types nil)) > - ;; We override mm-save-part as notmuch-show-save-part is better > - ;; since it offers the filename. We need to lexically bind > - ;; everything we need for notmuch-show-save-part to prevent > - ;; potential dynamic shadowing. > - (lexical-let ((message-id message-id) > - (nth nth) > - (filename filename) > - (content-type content-type)) > - (flet ((mm-save-part (&rest args) (notmuch-show-save-part > - message-id nth filename content-type))) > - (mm-display-part handle)))))) > + (let* ((disposition (if filename `(attachment (filename . ,filename)))) > + (handle (mm-make-handle (current-buffer) (list content-type) > + nil nil disposition)) > + ;; Set the default save directory to be consistent with > + ;; `notmuch-show-save-part'. > + (mm-default-directory (or mailcap-download-directory "~/")) > + ;; set mm-inlined-types to nil to force an external viewer > + (mm-inlined-types nil)) > + (mm-display-part handle)))) > > (defun notmuch-show-interactively-view-part (message-id nth &optional filename content-type) > (notmuch-with-temp-part-buffer message-id nth > -- > 1.7.10.4