[PATCH 14/21] vim: add option to compose new messages
authorFelipe Contreras <felipe.contreras@gmail.com>
Sat, 2 Nov 2013 13:55:47 +0000 (07:55 +1800)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:54 +0000 (09:57 -0800)
0b/027057727dfe567ff50fa2cc466c38df7cea00 [new file with mode: 0644]

diff --git a/0b/027057727dfe567ff50fa2cc466c38df7cea00 b/0b/027057727dfe567ff50fa2cc466c38df7cea00
new file mode 100644 (file)
index 0000000..16e8512
--- /dev/null
@@ -0,0 +1,142 @@
+Return-Path: <felipe.contreras@gmail.com>\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 64768431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Nov 2013 07:03:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 u4j0GMEUADA6 for <notmuch@notmuchmail.org>;\r
+       Sat,  2 Nov 2013 07:03:49 -0700 (PDT)\r
+Received: from mail-ob0-f175.google.com (mail-ob0-f175.google.com\r
+       [209.85.214.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 2FF24431FC3\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Nov 2013 07:03:12 -0700 (PDT)\r
+Received: by mail-ob0-f175.google.com with SMTP id wm4so5550809obc.6\r
+       for <notmuch@notmuchmail.org>; Sat, 02 Nov 2013 07:03:11 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=r/du2J/bmZ2YJ8fGvUcMS5dYvOq/yYyH4PxNGmD8LBE=;\r
+       b=qk5wjgKjr81qIrDcX5UuBkofvMLt155yK1qad2FA6qtx/lW+p44QH/XTocEhS5FyFw\r
+       PRVIPtxSBph9h0zzmEvx2QElKnKeouq4l0MLEBGbiXIoF0QwKoeTMS4BMALYsY8HFGpo\r
+       sFXgtq+g55evIFRrMwBwH1eMWtGV2thHCIr+LjXYhuGckIQAj81EjnP1pgKotty2s993\r
+       QSJxVo6bAG0dJiqD+kQ+fJnnChU+oScvNyY1bB0dtWoVZYSi4vKRbLM8H1pAuNQjluou\r
+       VEkRnhgaQjaSShZZu0KdfDQiKZuRfE9tZHa6F90NEX4I7NgFZE22ZR7QEZUnRMFc/3Cn\r
+       RLiA==\r
+X-Received: by 10.60.39.67 with SMTP id n3mr6441829oek.2.1383400991718;\r
+       Sat, 02 Nov 2013 07:03:11 -0700 (PDT)\r
+Received: from localhost (187-162-140-241.static.axtel.net. [187.162.140.241])\r
+       by mx.google.com with ESMTPSA id j9sm5189597oef.8.2013.11.02.07.03.10\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+       Sat, 02 Nov 2013 07:03:10 -0700 (PDT)\r
+From: Felipe Contreras <felipe.contreras@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 14/21] vim: add option to compose new messages\r
+Date: Sat,  2 Nov 2013 07:55:47 -0600\r
+Message-Id: <1383400554-1832-15-git-send-email-felipe.contreras@gmail.com>\r
+X-Mailer: git-send-email 1.8.4.2+fc1\r
+In-Reply-To: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com>\r
+References: <1383400554-1832-1-git-send-email-felipe.contreras@gmail.com>\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, 02 Nov 2013 14:03:54 -0000\r
+\r
+Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\r
+---\r
+ vim/notmuch.vim | 33 +++++++++++++++++++++++++++++++++\r
+ 1 file changed, 33 insertions(+)\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index 8383fd6..42c5f18 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -12,6 +12,7 @@ let g:notmuch_rb_folders_maps = {\r
+       \ '<Enter>':    'folders_show_search()',\r
+       \ 's':          'folders_search_prompt()',\r
+       \ '=':          'folders_refresh()',\r
++      \ 'c':          'compose()',\r
+       \ }\r
\r
+ let g:notmuch_rb_search_maps = {\r
+@@ -24,6 +25,7 @@ let g:notmuch_rb_search_maps = {\r
+       \ 's':          'search_search_prompt()',\r
+       \ '=':          'search_refresh()',\r
+       \ '?':          'search_info()',\r
++      \ 'c':          'compose()',\r
+       \ }\r
\r
+ let g:notmuch_rb_show_maps = {\r
+@@ -38,6 +40,7 @@ let g:notmuch_rb_show_maps = {\r
+       \ 'r':          'show_reply()',\r
+       \ '?':          'show_info()',\r
+       \ '<Tab>':      'show_next_msg()',\r
++      \ 'c':          'compose()',\r
+       \ }\r
\r
+ let g:notmuch_rb_compose_maps = {\r
+@@ -148,6 +151,14 @@ function! s:show_reply()\r
+       startinsert!\r
+ endfunction\r
\r
++function! s:compose()\r
++      ruby open_compose\r
++      let b:compose_done = 0\r
++      call s:set_map(g:notmuch_rb_compose_maps)\r
++      autocmd BufUnload <buffer> call s:compose_unload()\r
++      startinsert!\r
++endfunction\r
++\r
+ function! s:show_info()\r
+       ruby vim_puts get_message.inspect\r
+ endfunction\r
+@@ -578,6 +589,28 @@ ruby << EOF\r
+               open_compose_helper(lines, cur)\r
+       end\r
\r
++      def open_compose()\r
++              lines = []\r
++\r
++              lines << "Date: #{Time.now().strftime('%a, %-d %b %Y %T %z')}"\r
++              lines << "From: #{$email}"\r
++              lines << "To: "\r
++              cur = lines.count\r
++\r
++              lines << "Cc: "\r
++              lines << "Bcc: "\r
++              lines << "Message-Id: #{generate_message_id}"\r
++              lines << "Subject: "\r
++              lines << "Mime-Version: 1.0"\r
++              lines << "Content-Type: text/plain; charset=utf-8"\r
++              lines << "Content-Transfer-Encoding: 7bit"\r
++              lines << ""\r
++              lines << ""\r
++              lines << ""\r
++\r
++              open_compose_helper(lines, cur)\r
++      end\r
++\r
+       def folders_render()\r
+               $curbuf.render do |b|\r
+                       folders = VIM::evaluate('g:notmuch_rb_folders')\r
+-- \r
+1.8.4.2+fc1\r
+\r