--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 30119431FBD\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 11:29:22 -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 tests=[none]\r
+ 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 IkUruiC2xLFv for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Oct 2014 11:29:14 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 78189431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 11:29:14 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 0DC3710009D;\r
+ Mon, 6 Oct 2014 21:28:56 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Ian Main <imain@stemwinder.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] VIM: Make an option to save sent mail locally\r
+In-Reply-To: <1412619036-29203-1-git-send-email-imain@stemwinder.org>\r
+References: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
+ <1412619036-29203-1-git-send-email-imain@stemwinder.org>\r
+User-Agent: Notmuch/0.18.1+130~ga61922f (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 06 Oct 2014 21:28:55 +0300\r
+Message-ID: <m27g0dt5lk.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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 18:29:22 -0000\r
+\r
+On Mon, Oct 06 2014, Ian Main <imain@stemwinder.org> wrote:\r
+\r
+> Add an option to use 'notmuch insert' to save your sent mail.\r
+> ---\r
+>\r
+> Add -inbox as well.\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..a9044c4 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
+AFAIU looks mmm. readable ;)\r
+\r
+> +\r
+> + if g:notmuch_save_sent_locally\r
+> + let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread -inbox')\r
+\r
+as this is (looks like) shell invocation, this could be in format\r
+\r
+let out = system('notmuch insert --create-folder --folder=Sent +sent -unread -inbox < ' . fname)\r
+\r
+or even \r
+\r
+let out = system('exec notmuch insert --create-folder --folder=Sent +sent -unread -inbox < ' . fname)\r
+\r
+(well, the latter would be out of the status quo)\r
+\r
+Ok, I looked a bit into the notmuch.vim -code, and noticed sometimes\r
+system() command lines use "notmuch" and sometimes g:notmuch_cmd \r
+-- I think the latter should be used in new code and the previous ones\r
+should be fixed.\r
+\r
+i.e. system ( g:notmuch_cmd . ' insert ... ' < . fname)\r
+\r
+Totally untested from my part...\r
+\r
+When the change alike this lands to the notmuch repository this needs NEWS\r
+item which informs that from now sent mails are notmuch-inserted to\r
+user's mail store (as this seems to be the default...) -- well, let's see\r
+that when there are real reviewers (i.e. those who are interested to and can\r
+test this).\r
+\r
+\r
+Tomi\r
+\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r