From 14155ebf14fbfde69b040514c6acef74bafb77ca Mon Sep 17 00:00:00 2001 From: Franz Fellner Date: Tue, 14 Oct 2014 15:45:35 +0200 Subject: [PATCH] Re: [PATCH] VIM: Make an option to save sent mail locally --- 01/6483b02651a10c8f9bda3e12e6858081666ebf | 144 ++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 01/6483b02651a10c8f9bda3e12e6858081666ebf diff --git a/01/6483b02651a10c8f9bda3e12e6858081666ebf b/01/6483b02651a10c8f9bda3e12e6858081666ebf new file mode 100644 index 000000000..5ff46ae03 --- /dev/null +++ b/01/6483b02651a10c8f9bda3e12e6858081666ebf @@ -0,0 +1,144 @@ +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 0734C431FB6 + for ; Tue, 14 Oct 2014 06:45:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 TNUpxN4bk-lH for ; + Tue, 14 Oct 2014 06:45:29 -0700 (PDT) +Received: from mail-la0-f47.google.com (mail-la0-f47.google.com + [209.85.215.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C0D28431FAF + for ; Tue, 14 Oct 2014 06:45:28 -0700 (PDT) +Received: by mail-la0-f47.google.com with SMTP id pv20so8400823lab.6 + for ; Tue, 14 Oct 2014 06:45:25 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=date:message-id:from:to:cc:subject:in-reply-to:references + :mime-version:content-type:content-disposition + :content-transfer-encoding; + bh=0mcLQD1QmOUzFvBJblncjftIOqHLJSzMqM5qaSbLj9U=; + b=cSv3pKEKWrrDpuvr/jI8N3rQQTtHWliezFWGmA08dWMA4WwFcw94K3Kv5XDV4MN2th + WbhdVT/ON9HMj7WmtACa8+LWGMsS9fd9zGzqDBNuPg/3mZQ6YaiRCVSPUX0M5xNTyeDA + KBRs6xE3jcmaTNXAHvNfkMGna8S4IgA8MTfo+PEeRIJ3le53ffYCQBBz2JzIXnS+ZG57 + ePmoyXFiW5dgi+3RHAC2PsZjMOP9EV3BQOoU/znMmJqj+vZQAtaO8MUz5lQncRXPJkBr + 0xmlV8B/qH/99jpnhkJX9x5btuscgrQOtY/KKDvVnO8oZhswqk0EG5lrZHoBz0YOU5Ar + LCmg== +X-Received: by 10.112.133.138 with SMTP id pc10mr5538692lbb.48.1413294325664; + Tue, 14 Oct 2014 06:45:25 -0700 (PDT) +Received: from localhost (p5B00C854.dip0.t-ipconnect.de. [91.0.200.84]) + by mx.google.com with ESMTPSA id bk5sm5617818lbd.30.2014.10.14.06.45.23 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Tue, 14 Oct 2014 06:45:24 -0700 (PDT) +Date: Tue, 14 Oct 2014 15:45:35 +0200 +Message-ID: <20141014154535.GJ23373@TP_L520.localdomain> +From: Franz Fellner +To: Ian Main +Subject: Re: [PATCH] VIM: Make an option to save sent mail locally +In-Reply-To: <1412619036-29203-1-git-send-email-imain@stemwinder.org> +References: <1412617904-27252-1-git-send-email-imain@stemwinder.org> + <1412619036-29203-1-git-send-email-imain@stemwinder.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +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 13:45:37 -0000 + +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. + +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. + +All in all the feature and the the rest of your work is very much +appreciated! + +Franz + +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