From c8f5110cd51cc419da06c5a43654aca951c5606c Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sun, 26 May 2013 10:31:13 +0300 Subject: [PATCH] Re: [PATCH v2] emacs: Don't override mm-show-part in notmuch-show-view-part --- 00/1aa320e9343e35cde02b1259393d6fcd439360 | 119 ++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 00/1aa320e9343e35cde02b1259393d6fcd439360 diff --git a/00/1aa320e9343e35cde02b1259393d6fcd439360 b/00/1aa320e9343e35cde02b1259393d6fcd439360 new file mode 100644 index 000000000..207a6c5e1 --- /dev/null +++ b/00/1aa320e9343e35cde02b1259393d6fcd439360 @@ -0,0 +1,119 @@ +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 6B2D6431FBF + for ; Sun, 26 May 2013 00:31:26 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 fYo7VQi5lImW for ; + Sun, 26 May 2013 00:31:18 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 85E60431FAE + for ; Sun, 26 May 2013 00:31:17 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 4E39E100093; + Sun, 26 May 2013 10:31:13 +0300 (EEST) +From: Tomi Ollila +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.15.2+115~g12cf6af (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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:31:26 -0000 + +On Sun, May 26 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'. + +LGTM. +1. + +Tomi + + +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2