Re: [PATCH 1/2] test: add check for <expected> filename argument for test_expect_equa...
[notmuch-archives.git] / c6 / c66f304291b71d985feaa2484d49fd78fa8a01
1 Return-Path: <keith@nicira.com>\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 87F30431FBC\r
6         for <notmuch@notmuchmail.org>; Sat,  5 Dec 2009 14:55:04 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id TzUI1nTPMhfC for <notmuch@notmuchmail.org>;\r
11         Sat,  5 Dec 2009 14:55:04 -0800 (PST)\r
12 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194])\r
13         by olra.theworths.org (Postfix) with ESMTP id 004FC431FAE\r
14         for <notmuch@notmuchmail.org>; Sat,  5 Dec 2009 14:55:03 -0800 (PST)\r
15 Received: from vps.nicira.com (66.7.219.28.static.dimenoc.com [66.7.219.28])\r
16         by mx.perfora.net (node=mxus2) with ESMTP (Nemesis)\r
17         id 0MDAhQ-1NKLKU48Pk-00GxiK for notmuch@notmuchmail.org;\r
18         Sat, 05 Dec 2009 17:55:03 -0500\r
19 Received: from hq.nicira.com ([209.172.104.10]:40204 helo=kea-nicira-lt)\r
20         by vps.nicira.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69)\r
21         (envelope-from <keith@nicira.com>)\r
22         id 1NH3Wm-00021s-6I; Sat, 05 Dec 2009 17:55:01 -0500\r
23 Received: by kea-nicira-lt (sSMTP sendmail emulation);\r
24         Sat, 05 Dec 2009 14:54:58 -0800\r
25 From: Keith Amidon <keith@nicira.com>\r
26 To: notmuch@notmuchmail.org\r
27 Date: Sat,  5 Dec 2009 14:54:00 -0800\r
28 Message-Id: <1260053640-10034-3-git-send-email-keith@nicira.com>\r
29 X-Mailer: git-send-email 1.6.5.4\r
30 In-Reply-To: <1260053640-10034-2-git-send-email-keith@nicira.com>\r
31 References: <1260053640-10034-1-git-send-email-keith@nicira.com>\r
32         <1260053640-10034-2-git-send-email-keith@nicira.com>\r
33 X-AntiAbuse: This header was added to track abuse,\r
34         please include it with any abuse report\r
35 X-AntiAbuse: Primary Hostname - vps.nicira.com\r
36 X-AntiAbuse: Original Domain - notmuchmail.org\r
37 X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]\r
38 X-AntiAbuse: Sender Address Domain - nicira.com\r
39 X-Source: \r
40 X-Source-Args: \r
41 X-Source-Dir: \r
42 X-Mailman-Approved-At: Mon, 07 Dec 2009 09:47:22 -0800\r
43 Cc: Keith Amidon <keith@nicira.com>\r
44 Subject: [notmuch] [PATCH 2/2] Save all attachments to a directory\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.12\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Sat, 05 Dec 2009 22:55:04 -0000\r
58 \r
59 Prompt for a directory and write all attachments of the current\r
60 message to that directory, prompting for a filename for each with a\r
61 default value of the filename specified in the attachment.\r
62 \r
63 The behavior of this function differs in two ways from the existing\r
64 notmuch-show-save-attachments function:\r
65 \r
66 1) It first prompts for the directory in which to save attachments\r
67    instead of assuming the current default directory.\r
68 \r
69 2) If there is more than one attachment in the message, it assumes all\r
70    should be saved and only prompts for filenames instead of asking\r
71    first whether each attachment should be saved.\r
72 ---\r
73  notmuch.el |   12 ++++++++++++\r
74  1 files changed, 12 insertions(+), 0 deletions(-)\r
75 \r
76 diff --git a/notmuch.el b/notmuch.el\r
77 index 8d51709..08bd114 100644\r
78 --- a/notmuch.el\r
79 +++ b/notmuch.el\r
80 @@ -65,6 +65,7 @@\r
81      (define-key map "r" 'notmuch-show-reply)\r
82      (define-key map "|" 'notmuch-show-pipe-message)\r
83      (define-key map "w" 'notmuch-show-save-attachments)\r
84 +    (define-key map "W" 'notmuch-show-save-all-attachments)\r
85      (define-key map "V" 'notmuch-show-view-raw-message)\r
86      (define-key map "v" 'notmuch-show-view-all-mime-parts)\r
87      (define-key map "-" 'notmuch-show-remove-tag)\r
88 @@ -352,6 +353,17 @@ buffer."\r
89        mm-handle (> (notmuch-count-attachments mm-handle) 1))))\r
90    (message "Done"))\r
91  \r
92 +(defun notmuch-show-save-all-attachments (directory)\r
93 +  "Save all attachments of a message to a directory."\r
94 +  (interactive "G")\r
95 +  (let ((dirname (file-name-as-directory directory)))\r
96 +    (make-directory dirname t)\r
97 +    (with-current-notmuch-show-message\r
98 +     (let ((mm-handle (mm-dissect-buffer))\r
99 +           (mm-default-directory dirname))\r
100 +       (notmuch-save-attachments mm-handle nil))))\r
101 +  (message "Done"))\r
102 +\r
103  (defun notmuch-reply (query-string)\r
104    (switch-to-buffer (generate-new-buffer "notmuch-draft"))\r
105    (call-process notmuch-command nil t nil "reply" query-string)\r
106 -- \r
107 1.6.5.4\r
108 \r