From 78a192382d75c9749c57909debba7982df17eb0a Mon Sep 17 00:00:00 2001 From: Ian Main Date: Tue, 7 Oct 2014 11:10:36 +1700 Subject: [PATCH] [PATCH] VIM: Make an option to save sent mail locally --- 8e/fbf217dcd43b8bc4ce22258fc7de8e6d39c198 | 100 ++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 8e/fbf217dcd43b8bc4ce22258fc7de8e6d39c198 diff --git a/8e/fbf217dcd43b8bc4ce22258fc7de8e6d39c198 b/8e/fbf217dcd43b8bc4ce22258fc7de8e6d39c198 new file mode 100644 index 000000000..bd56176b6 --- /dev/null +++ b/8e/fbf217dcd43b8bc4ce22258fc7de8e6d39c198 @@ -0,0 +1,100 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 52576431FBC + for ; Mon, 6 Oct 2014 11:10:45 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id oawazNFRnSiG for ; + Mon, 6 Oct 2014 11:10:39 -0700 (PDT) +Received: from cmta9.telus.net (cmta9.telus.net [209.171.16.82]) + by olra.theworths.org (Postfix) with ESMTP id B7208431FAE + for ; Mon, 6 Oct 2014 11:10:39 -0700 (PDT) +Received: from ovo.mains.priv ([207.102.88.62]) by cmta9.telus.net with TELUS + id zuAe1o05H1LiWEf01uAehs; Mon, 06 Oct 2014 12:10:39 -0600 +X-Authority-Analysis: v=2.0 cv=KNmE+i5o c=1 sm=2 + a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8 + a=Z2xPzeXNZ0CE_Iho6mIA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117 +X-Telus-Outbound-IP: 207.102.88.62 +From: Ian Main +To: notmuch@notmuchmail.org +Subject: [PATCH] VIM: Make an option to save sent mail locally +Date: Mon, 6 Oct 2014 11:10:36 -0700 +Message-Id: <1412619036-29203-1-git-send-email-imain@stemwinder.org> +X-Mailer: git-send-email 1.9.3 +In-Reply-To: <1412617904-27252-1-git-send-email-imain@stemwinder.org> +References: <1412617904-27252-1-git-send-email-imain@stemwinder.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 06 Oct 2014 18:10:45 -0000 + +Add an option to use 'notmuch insert' to save your sent mail. +--- + +Add -inbox as well. + + vim/notmuch.vim | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/vim/notmuch.vim b/vim/notmuch.vim +index 331e930..a9044c4 100644 +--- a/vim/notmuch.vim ++++ b/vim/notmuch.vim +@@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y' + let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S' + let s:notmuch_reader_default = 'mutt -f %s' + let s:notmuch_sendmail_default = 'sendmail' ++let s:notmuch_save_sent_locally_default = 1 + let s:notmuch_folders_count_threads_default = 0 + + function! s:new_file_buffer(type, fname) +@@ -108,6 +109,18 @@ EOF + echohl None + return + endif ++ ++ if g:notmuch_save_sent_locally ++ let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread -inbox') ++ let err = v:shell_error ++ if err ++ echohl Error ++ echo 'Eeek! unable to save sent mail' ++ echo out ++ echohl None ++ return ++ endif ++ endif + call delete(fname) + echo 'Mail sent successfully.' + call s:kill_this_buffer() +@@ -388,6 +401,10 @@ endfunction + "" root + + function! s:set_defaults() ++ if !exists('g:notmuch_save_sent_locally') ++ let g:notmuch_save_sent_locally = s:notmuch_save_sent_locally_default ++ endif ++ + if !exists('g:notmuch_date_format') + if exists('g:notmuch_rb_date_format') + let g:notmuch_date_format = g:notmuch_rb_date_format +-- +1.9.3 + -- 2.26.2