[PATCH] VIM: Make an option to save sent mail locally
authorIan Main <imain@stemwinder.org>
Mon, 6 Oct 2014 17:51:44 +0000 (10:51 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:05:04 +0000 (10:05 -0800)
da/d0fa7aafa4e4009528d9c0ccaf28d98b71628a [new file with mode: 0644]

diff --git a/da/d0fa7aafa4e4009528d9c0ccaf28d98b71628a b/da/d0fa7aafa4e4009528d9c0ccaf28d98b71628a
new file mode 100644 (file)
index 0000000..cbe7c01
--- /dev/null
@@ -0,0 +1,95 @@
+Return-Path: <imain@stemwinder.org>\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 50650431FB6\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 10:51:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 u8TWWJ5VW0hE for <notmuch@notmuchmail.org>;\r
+       Mon,  6 Oct 2014 10:51:52 -0700 (PDT)\r
+Received: from cmta15.telus.net (cmta15.telus.net [209.171.16.88])\r
+       by olra.theworths.org (Postfix) with ESMTP id B4C64431FAE\r
+       for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 10:51:52 -0700 (PDT)\r
+Received: from ovo.mains.priv ([207.102.88.62]) by cmta15.telus.net with TELUS\r
+       id ztrq1o00f1LiWEf01trr4i; Mon, 06 Oct 2014 11:51:51 -0600\r
+X-Authority-Analysis: v=2.0 cv=ZZnDwLpA c=1 sm=2\r
+       a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
+       a=FVT5KAsjRlHC016-YJAA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117\r
+X-Telus-Outbound-IP: 207.102.88.62\r
+From: Ian Main <imain@stemwinder.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] VIM: Make an option to save sent mail locally\r
+Date: Mon,  6 Oct 2014 10:51:44 -0700\r
+Message-Id: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
+X-Mailer: git-send-email 1.9.3\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: Mon, 06 Oct 2014 17:51:58 -0000\r
+\r
+Add an option to use 'notmuch insert' to save your sent mail.\r
+---\r
+ vim/notmuch.vim | 17 +++++++++++++++++\r
+ 1 file changed, 17 insertions(+)\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index 331e930..cb280c3 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y'\r
+ let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S'\r
+ let s:notmuch_reader_default = 'mutt -f %s'\r
+ let s:notmuch_sendmail_default = 'sendmail'\r
++let s:notmuch_save_sent_locally_default = 1\r
+ let s:notmuch_folders_count_threads_default = 0\r
\r
+ function! s:new_file_buffer(type, fname)\r
+@@ -108,6 +109,18 @@ EOF\r
+               echohl None\r
+               return\r
+       endif\r
++\r
++      if g:notmuch_save_sent_locally\r
++              let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread')\r
++              let err = v:shell_error\r
++              if err\r
++                      echohl Error\r
++                      echo 'Eeek! unable to save sent mail'\r
++                      echo out\r
++                      echohl None\r
++                      return\r
++              endif\r
++      endif\r
+       call delete(fname)\r
+       echo 'Mail sent successfully.'\r
+       call s:kill_this_buffer()\r
+@@ -388,6 +401,10 @@ endfunction\r
+ "" root\r
\r
+ function! s:set_defaults()\r
++      if !exists('g:notmuch_save_sent_locally')\r
++              let g:notmuch_save_sent_locally = s:notmuch_save_sent_locally_default\r
++      endif\r
++\r
+       if !exists('g:notmuch_date_format')\r
+               if exists('g:notmuch_rb_date_format')\r
+                       let g:notmuch_date_format = g:notmuch_rb_date_format\r
+-- \r
+1.9.3\r
+\r