From: Ian Main Date: Tue, 7 Oct 2014 04:16:52 +0000 (+1700) Subject: Re: [PATCH] VIM: Make an option to save sent mail locally X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b82f1e275830f628fa1c3410bafe67296aa709a9;p=notmuch-archives.git Re: [PATCH] VIM: Make an option to save sent mail locally --- diff --git a/72/b35dd214a31b57a5dd1637108bb4b59ddf2e9e b/72/b35dd214a31b57a5dd1637108bb4b59ddf2e9e new file mode 100644 index 000000000..e7f5c5ced --- /dev/null +++ b/72/b35dd214a31b57a5dd1637108bb4b59ddf2e9e @@ -0,0 +1,130 @@ +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 1032C431FAF + for ; Mon, 6 Oct 2014 21:17:07 -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 OCITKx3T+46O for ; + Mon, 6 Oct 2014 21:16:59 -0700 (PDT) +Received: from cmta19.telus.net (cmta19.telus.net [209.171.16.92]) + by olra.theworths.org (Postfix) with ESMTP id ACB04431FAE + for ; Mon, 6 Oct 2014 21:16:59 -0700 (PDT) +Received: from ovo.mains.priv ([207.102.88.62]) by cmta19.telus.net with TELUS + id 04Gw1p00A1LiWEf014GwRu; Mon, 06 Oct 2014 22:16:58 -0600 +X-Authority-Analysis: v=2.0 cv=fJznK+me c=1 sm=2 + a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=IkcTkHD0fZMA:10 + a=tsa3CZZnAAAA:8 a=YrYOZUNBYV6lC7RO51gA:9 a=QEXdDO2ut3YA:10 + a=P87eogJZi2UA:10 a=EcQDfIwDZEqJA1f7rVUV8Q==:117 +X-Telus-Outbound-IP: 207.102.88.62 +Received: from ovo.mains.priv (localhost.localdomain [127.0.0.1]) + by ovo.mains.priv (8.14.8/8.14.8) with ESMTP id s974Grn9032621; + Mon, 6 Oct 2014 21:16:53 -0700 +Received: (from imain@localhost) + by ovo.mains.priv (8.14.8/8.14.8/Submit) id s974GqdY032620; + Mon, 6 Oct 2014 21:16:52 -0700 +X-Authentication-Warning: ovo.mains.priv: imain set sender to imain@redhat.com + using -f +Date: Mon, 06 Oct 2014 21:16:52 -0700 +From: Ian Main +To: Tomi Ollila , notmuch@notmuchmail.org +Message-ID: <5433693499518_7e54e45e9424@ovo.mains.priv.notmuch> +In-Reply-To: +References: <1412617904-27252-1-git-send-email-imain@stemwinder.org> + <1412619036-29203-1-git-send-email-imain@stemwinder.org> + +Subject: Re: [PATCH] VIM: Make an option to save sent mail locally +Mime-Version: 1.0 +Content-Type: text/plain; + charset=utf-8 +Content-Transfer-Encoding: 7bit +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: Tue, 07 Oct 2014 04:17:07 -0000 + +Tomi Ollila wrote: +> On Mon, Oct 06 2014, Ian Main 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 +> +> AFAIU looks mmm. readable ;) +> +> > + +> > + if g:notmuch_save_sent_locally +> > + let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread -inbox') +> +> as this is (looks like) shell invocation, this could be in format +> +> let out = system('notmuch insert --create-folder --folder=Sent +sent -unread -inbox < ' . fname) + +You are right, that's better. + +> or even +> +> let out = system('exec notmuch insert --create-folder --folder=Sent +sent -unread -inbox < ' . fname) +> +> (well, the latter would be out of the status quo) +> +> Ok, I looked a bit into the notmuch.vim -code, and noticed sometimes +> system() command lines use "notmuch" and sometimes g:notmuch_cmd +> -- I think the latter should be used in new code and the previous ones +> should be fixed. +> +> i.e. system ( g:notmuch_cmd . ' insert ... ' < . fname) +> +> Totally untested from my part... +> +> When the change alike this lands to the notmuch repository this needs NEWS +> item which informs that from now sent mails are notmuch-inserted to +> user's mail store (as this seems to be the default...) -- well, let's see +> that when there are real reviewers (i.e. those who are interested to and can +> test this). + +Also a good suggestion. From what I see they always use 'notmuch' straight up +which is probably a reasonable assumption. I do think the actual init code for +vim could have a few more checks, such as verifying that 'notmuch' is in $PATH +etc. + +Thanks for the review!! I'll send out a new rev tomorrow - very tired right now. + + Ian