unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] VIM: Make an option to save sent mail locally
@ 2014-10-06 17:51 Ian Main
  2014-10-06 18:10 ` Ian Main
  2014-10-20 17:58 ` [PATCH v2] " Ian Main
  0 siblings, 2 replies; 13+ messages in thread
From: Ian Main @ 2014-10-06 17:51 UTC (permalink / raw)
  To: notmuch

Add an option to use 'notmuch insert' to save your sent mail.
---
 vim/notmuch.vim | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/vim/notmuch.vim b/vim/notmuch.vim
index 331e930..cb280c3 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')
+		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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-02-05 10:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-06 17:51 [PATCH] VIM: Make an option to save sent mail locally Ian Main
2014-10-06 18:10 ` Ian Main
2014-10-06 18:28   ` Tomi Ollila
2014-10-07  4:16     ` Ian Main
2014-10-19  9:53       ` Tomi Ollila
2014-10-14 13:45   ` Franz Fellner
2014-10-14 17:32     ` Ian Main
2014-10-18 20:27       ` Franz Fellner
2015-01-13  0:08       ` Bartosz Telenczuk
2015-01-21 19:05         ` Franz Fellner
2015-02-02 23:42           ` Bartosz Telenczuk
2015-02-05 10:34             ` Franz Fellner
2014-10-20 17:58 ` [PATCH v2] " Ian Main

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).