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

diff --git a/e9/eb3a31c0b1eb632d08f27983fe4405f55c50f4 b/e9/eb3a31c0b1eb632d08f27983fe4405f55c50f4
new file mode 100644 (file)
index 0000000..4164123
--- /dev/null
@@ -0,0 +1,106 @@
+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 1701A431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 10:59:03 -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 k0W4zZ1vQnvP for <notmuch@notmuchmail.org>;\r
+       Mon, 20 Oct 2014 10:58:57 -0700 (PDT)\r
+Received: from cmta9.telus.net (cmta9.telus.net [209.171.16.82])\r
+       by olra.theworths.org (Postfix) with ESMTP id 740D8431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 10:58:57 -0700 (PDT)\r
+Received: from ovo.mains.priv ([207.102.88.62]) by cmta9.telus.net with TELUS\r
+       id 5Vyv1p0051LiWEf01Vyv7a; Mon, 20 Oct 2014 11:58:56 -0600\r
+X-Authority-Analysis: v=2.0 cv=KNmE+i5o c=1 sm=2\r
+       a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
+       a=a8Ndk92kl3mRpADGGBkA: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 v2] VIM: Make an option to save sent mail locally\r
+Date: Mon, 20 Oct 2014 10:58:50 -0700\r
+Message-Id: <1413827930-2493-1-git-send-email-imain@stemwinder.org>\r
+X-Mailer: git-send-email 1.9.3\r
+In-Reply-To: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
+References: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\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, 20 Oct 2014 17:59:03 -0000\r
+\r
+Add an option to use 'notmuch insert' to save your sent mail.\r
+---\r
+\r
+This update changes the 'system' line and adds a sent mailbox\r
+option.\r
+\r
+ vim/notmuch.vim | 22 ++++++++++++++++++++++\r
+ 1 file changed, 22 insertions(+)\r
+\r
+diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
+index 331e930..b0c6ebd 100644\r
+--- a/vim/notmuch.vim\r
++++ b/vim/notmuch.vim\r
+@@ -58,6 +58,8 @@ 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_save_sent_mailbox_default = 'Sent'\r
+ let s:notmuch_folders_count_threads_default = 0\r
\r
+ function! s:new_file_buffer(type, fname)\r
+@@ -108,6 +110,18 @@ EOF\r
+               echohl None\r
+               return\r
+       endif\r
++\r
++      if g:notmuch_save_sent_locally\r
++              let out = system('notmuch insert --create-folder --folder=' . g:notmuch_save_sent_mailbox . ' +sent -unread -inbox < ' . fname)\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 +402,14 @@ 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_save_sent_mailbox')\r
++              let g:notmuch_save_sent_mailbox = s:notmuch_save_sent_mailbox_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