[PATCH 4/4] VIM: adding attachments
authorBartosz <telenczuk@unic.cnrs-gif.fr>
Sat, 10 Jan 2015 12:03:04 +0000 (13:03 +0100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:19 +0000 (14:47 -0700)
8b/517f5021d98297c9c56a0f2ed6e3510ac2bb0f [new file with mode: 0644]

diff --git a/8b/517f5021d98297c9c56a0f2ed6e3510ac2bb0f b/8b/517f5021d98297c9c56a0f2ed6e3510ac2bb0f
new file mode 100644 (file)
index 0000000..78a6e91
--- /dev/null
@@ -0,0 +1,78 @@
+Return-Path: <telenczuk@unic.cnrs-gif.fr>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 94FE6429E40\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:03:41 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.438\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
+       tests=[DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id MQj2DtBuq5Xt for <notmuch@notmuchmail.org>;\r
+       Sat, 10 Jan 2015 04:03:38 -0800 (PST)\r
+Received: from smtp.webfaction.com (mail6.webfaction.com [74.55.86.74])\r
+       by olra.theworths.org (Postfix) with ESMTP id D6197429E4B\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:03:37 -0800 (PST)\r
+Received: from localhost (87-231-242-54.rev.numericable.fr [87.231.242.54])\r
+       by smtp.webfaction.com (Postfix) with ESMTP id D66B22078836;\r
+       Sat, 10 Jan 2015 12:03:35 +0000 (UTC)\r
+From: Bartosz <telenczuk@unic.cnrs-gif.fr>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/4] VIM: adding attachments\r
+Date: Sat, 10 Jan 2015 13:03:04 +0100\r
+Message-Id: <1420891384-992-5-git-send-email-telenczuk@unic.cnrs-gif.fr>\r
+X-Mailer: git-send-email 1.9.3 (Apple Git-50)\r
+In-Reply-To: <1420891384-992-1-git-send-email-telenczuk@unic.cnrs-gif.fr>\r
+References: <1420891384-992-1-git-send-email-telenczuk@unic.cnrs-gif.fr>\r
+X-Mailman-Approved-At: Sat, 10 Jan 2015 10:22:24 -0800\r
+Cc: Bartosz <telenczuk@unic.cnrs-gif.fr>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 10 Jan 2015 12:03:41 -0000\r
+\r
+files to be attached are listed at the end of composed message as\r
+paths prefixed by "Attachment:"\r
+---\r
+ vim/notmuch.vim | 11 +++++++++--\r
+ 1 file changed, 9 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index e95db4d..d999aef 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -92,9 +92,16 @@ function! s:compose_send()\r
\r
+ ruby << EOF\r
+       # Generate proper mail to send\r
+-      text = VIM::evaluate('lines').join("\n")\r
+-      fname = VIM::evaluate('fname')\r
++      text = VIM::evaluate('lines')\r
++      attached_filenames = text.reverse.take_while { |line| line.start_with?("Attachment:") }\r
++      text = text.reverse.drop_while { |line| line.start_with?("Attachment:") } . reverse\r
++      text = text.join("\n")\r
+       transport = Mail.new(text)\r
++      attached_filenames.each do |afname|\r
++          transport.add_file(afname[11..-1].strip)\r
++      end\r
++          \r
++      fname = VIM::evaluate('fname')\r
+       transport.message_id = generate_message_id\r
+       transport.charset = 'utf-8'\r
+       File.write(fname, transport.to_s)\r
+-- \r
+1.9.3 (Apple Git-50)\r
+\r