1 Return-Path: <telenczuk@unic.cnrs-gif.fr>
\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 94FE6429E40
\r
6 for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:03:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5
\r
12 tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id MQj2DtBuq5Xt for <notmuch@notmuchmail.org>;
\r
16 Sat, 10 Jan 2015 04:03:38 -0800 (PST)
\r
17 Received: from smtp.webfaction.com (mail6.webfaction.com [74.55.86.74])
\r
18 by olra.theworths.org (Postfix) with ESMTP id D6197429E4B
\r
19 for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:03:37 -0800 (PST)
\r
20 Received: from localhost (87-231-242-54.rev.numericable.fr [87.231.242.54])
\r
21 by smtp.webfaction.com (Postfix) with ESMTP id D66B22078836;
\r
22 Sat, 10 Jan 2015 12:03:35 +0000 (UTC)
\r
23 From: Bartosz <telenczuk@unic.cnrs-gif.fr>
\r
24 To: notmuch@notmuchmail.org
\r
25 Subject: [PATCH 4/4] VIM: adding attachments
\r
26 Date: Sat, 10 Jan 2015 13:03:04 +0100
\r
27 Message-Id: <1420891384-992-5-git-send-email-telenczuk@unic.cnrs-gif.fr>
\r
28 X-Mailer: git-send-email 1.9.3 (Apple Git-50)
\r
29 In-Reply-To: <1420891384-992-1-git-send-email-telenczuk@unic.cnrs-gif.fr>
\r
30 References: <1420891384-992-1-git-send-email-telenczuk@unic.cnrs-gif.fr>
\r
31 X-Mailman-Approved-At: Sat, 10 Jan 2015 10:22:24 -0800
\r
32 Cc: Bartosz <telenczuk@unic.cnrs-gif.fr>
\r
33 X-BeenThere: notmuch@notmuchmail.org
\r
34 X-Mailman-Version: 2.1.13
\r
36 List-Id: "Use and development of the notmuch mail system."
\r
37 <notmuch.notmuchmail.org>
\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
39 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
41 List-Post: <mailto:notmuch@notmuchmail.org>
\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
45 X-List-Received-Date: Sat, 10 Jan 2015 12:03:41 -0000
\r
47 files to be attached are listed at the end of composed message as
\r
48 paths prefixed by "Attachment:"
\r
50 vim/notmuch.vim | 11 +++++++++--
\r
51 1 file changed, 9 insertions(+), 2 deletions(-)
\r
53 diff --git a/vim/notmuch.vim b/vim/notmuch.vim
\r
54 index e95db4d..d999aef 100644
\r
55 --- a/vim/notmuch.vim
\r
56 +++ b/vim/notmuch.vim
\r
57 @@ -92,9 +92,16 @@ function! s:compose_send()
\r
60 # Generate proper mail to send
\r
61 - text = VIM::evaluate('lines').join("\n")
\r
62 - fname = VIM::evaluate('fname')
\r
63 + text = VIM::evaluate('lines')
\r
64 + attached_filenames = text.reverse.take_while { |line| line.start_with?("Attachment:") }
\r
65 + text = text.reverse.drop_while { |line| line.start_with?("Attachment:") } . reverse
\r
66 + text = text.join("\n")
\r
67 transport = Mail.new(text)
\r
68 + attached_filenames.each do |afname|
\r
69 + transport.add_file(afname[11..-1].strip)
\r
72 + fname = VIM::evaluate('fname')
\r
73 transport.message_id = generate_message_id
\r
74 transport.charset = 'utf-8'
\r
75 File.write(fname, transport.to_s)
\r
77 1.9.3 (Apple Git-50)
\r