Franz Fellner wrote: > Why not simply use Notmuch::Database.add_message? Would save a > system-call. > One could easily copy the sent mail into nm_db_path/sent/cur, add it to the db, tag it. > Though I don't know enough about maildir handling, but probably rubys > Mail module could help here. So you are saying I'd have to copy the message to the database and then call Notmuch::Database.add_message()? If so I think I'd rather stick with the system call.. > Another issue is configuration. Hardcoding "Sent" probably won't fit > everyones needs. And (if I understand DOCS correctly) db.add_message > doesn't even force you to keep sent mail folder inside db_path; correct > me if I'm wrong :) notmuch --insert will put it into folder relative to > db_path. Yeah, I can add it so the folder can be changed. I figured this was just the start of things. Really we should be able to fcc it to our upstream provider sent mailbox too. The notmuch --insert with --create-folder takes care of making sure the folder exists locally. I think this is why using the CLI is pretty compelling. You know it will do the right thing. > All in all the feature and the the rest of your work is very much > appreciated! > > Franz Thanks for the review Franz! I'll do another round of patch fixing soon I'm sure. Ian > On Mon, 6 Oct 2014 11:10:36 -0700, Ian Main <imain@stemwinder.org> wrote: > > 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 > > > > _______________________________________________ > > notmuch mailing list > > notmuch@notmuchmail.org > > http://notmuchmail.org/mailman/listinfo/notmuch