From fa3ad897188232e336b8fcbbba92f3449a2ac648 Mon Sep 17 00:00:00 2001 From: Ian Main Date: Wed, 15 Oct 2014 10:32:25 +1700 Subject: [PATCH] Re: [PATCH] VIM: Make an option to save sent mail locally --- ad/c981cb264155b4a433e7b3174b3b05c9b0b8fc | 157 ++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 ad/c981cb264155b4a433e7b3174b3b05c9b0b8fc diff --git a/ad/c981cb264155b4a433e7b3174b3b05c9b0b8fc b/ad/c981cb264155b4a433e7b3174b3b05c9b0b8fc new file mode 100644 index 000000000..ea2aa734f --- /dev/null +++ b/ad/c981cb264155b4a433e7b3174b3b05c9b0b8fc @@ -0,0 +1,157 @@ +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 861E5431FB6 + for ; Tue, 14 Oct 2014 10:32:37 -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 w8HVTZaooOT4 for ; + Tue, 14 Oct 2014 10:32:31 -0700 (PDT) +Received: from cmta7.telus.net (cmta7.telus.net [209.171.16.80]) + by olra.theworths.org (Postfix) with ESMTP id 70FC4431FAF + for ; Tue, 14 Oct 2014 10:32:31 -0700 (PDT) +Received: from ovo.mains.priv ([207.102.88.62]) by cmta7.telus.net with TELUS + id 35YV1p00B1LiWEf015YV4q; Tue, 14 Oct 2014 11:32:30 -0600 +X-Authority-Analysis: v=2.0 cv=TdpIQ2sh c=1 sm=2 + a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=IkcTkHD0fZMA:10 + a=tsa3CZZnAAAA:8 a=7343-z1_AAAA:8 a=7bbuMW5nppRtDaXMQKkA:9 + a=QEXdDO2ut3YA:10 + a=P87eogJZi2UA:10 a=0c-eHkXYtrgA: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 s9EHWQa2023228; + Tue, 14 Oct 2014 10:32:28 -0700 +Received: (from imain@localhost) + by ovo.mains.priv (8.14.8/8.14.8/Submit) id s9EHWPuP023227; + Tue, 14 Oct 2014 10:32:25 -0700 +X-Authentication-Warning: ovo.mains.priv: imain set sender to imain@redhat.com + using -f +Date: Tue, 14 Oct 2014 10:32:25 -0700 +From: Ian Main +To: Franz Fellner +Message-ID: <543d5e2927b41_5918e8fe90f4@ovo.mains.priv.notmuch> +In-Reply-To: <20141014154535.GJ23373@TP_L520.localdomain> +References: <1412617904-27252-1-git-send-email-imain@stemwinder.org> + <1412619036-29203-1-git-send-email-imain@stemwinder.org> + <20141014154535.GJ23373@TP_L520.localdomain> +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 +Cc: notmuch@notmuchmail.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: Tue, 14 Oct 2014 17:32:37 -0000 + +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 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 + + -- 2.26.2