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 87F30431FBC for ; Sat, 5 Dec 2009 14:55:04 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 TzUI1nTPMhfC for ; Sat, 5 Dec 2009 14:55:04 -0800 (PST) Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) by olra.theworths.org (Postfix) with ESMTP id 004FC431FAE for ; Sat, 5 Dec 2009 14:55:03 -0800 (PST) Received: from vps.nicira.com (66.7.219.28.static.dimenoc.com [66.7.219.28]) by mx.perfora.net (node=mxus2) with ESMTP (Nemesis) id 0MDAhQ-1NKLKU48Pk-00GxiK for notmuch@notmuchmail.org; Sat, 05 Dec 2009 17:55:03 -0500 Received: from hq.nicira.com ([209.172.104.10]:40204 helo=kea-nicira-lt) by vps.nicira.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1NH3Wm-00021s-6I; Sat, 05 Dec 2009 17:55:01 -0500 Received: by kea-nicira-lt (sSMTP sendmail emulation); Sat, 05 Dec 2009 14:54:58 -0800 From: Keith Amidon To: notmuch@notmuchmail.org Date: Sat, 5 Dec 2009 14:54:00 -0800 Message-Id: <1260053640-10034-3-git-send-email-keith@nicira.com> X-Mailer: git-send-email 1.6.5.4 In-Reply-To: <1260053640-10034-2-git-send-email-keith@nicira.com> References: <1260053640-10034-1-git-send-email-keith@nicira.com> <1260053640-10034-2-git-send-email-keith@nicira.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.nicira.com X-AntiAbuse: Original Domain - notmuchmail.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nicira.com X-Source: X-Source-Args: X-Source-Dir: X-Mailman-Approved-At: Mon, 07 Dec 2009 09:47:22 -0800 Cc: Keith Amidon Subject: [notmuch] [PATCH 2/2] Save all attachments to a directory X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 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: Sat, 05 Dec 2009 22:55:04 -0000 Prompt for a directory and write all attachments of the current message to that directory, prompting for a filename for each with a default value of the filename specified in the attachment. The behavior of this function differs in two ways from the existing notmuch-show-save-attachments function: 1) It first prompts for the directory in which to save attachments instead of assuming the current default directory. 2) If there is more than one attachment in the message, it assumes all should be saved and only prompts for filenames instead of asking first whether each attachment should be saved. --- notmuch.el | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index 8d51709..08bd114 100644 --- a/notmuch.el +++ b/notmuch.el @@ -65,6 +65,7 @@ (define-key map "r" 'notmuch-show-reply) (define-key map "|" 'notmuch-show-pipe-message) (define-key map "w" 'notmuch-show-save-attachments) + (define-key map "W" 'notmuch-show-save-all-attachments) (define-key map "V" 'notmuch-show-view-raw-message) (define-key map "v" 'notmuch-show-view-all-mime-parts) (define-key map "-" 'notmuch-show-remove-tag) @@ -352,6 +353,17 @@ buffer." mm-handle (> (notmuch-count-attachments mm-handle) 1)))) (message "Done")) +(defun notmuch-show-save-all-attachments (directory) + "Save all attachments of a message to a directory." + (interactive "G") + (let ((dirname (file-name-as-directory directory))) + (make-directory dirname t) + (with-current-notmuch-show-message + (let ((mm-handle (mm-dissect-buffer)) + (mm-default-directory dirname)) + (notmuch-save-attachments mm-handle nil)))) + (message "Done")) + (defun notmuch-reply (query-string) (switch-to-buffer (generate-new-buffer "notmuch-draft")) (call-process notmuch-command nil t nil "reply" query-string) -- 1.6.5.4