RE: [PATCH] VIM: Improve performance of folders_render
[notmuch-archives.git] / da / d0fa7aafa4e4009528d9c0ccaf28d98b71628a
1 Return-Path: <imain@stemwinder.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 50650431FB6\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 10:51:58 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id u8TWWJ5VW0hE for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Oct 2014 10:51:52 -0700 (PDT)\r
17 Received: from cmta15.telus.net (cmta15.telus.net [209.171.16.88])\r
18         by olra.theworths.org (Postfix) with ESMTP id B4C64431FAE\r
19         for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 10:51:52 -0700 (PDT)\r
20 Received: from ovo.mains.priv ([207.102.88.62]) by cmta15.telus.net with TELUS\r
21         id ztrq1o00f1LiWEf01trr4i; Mon, 06 Oct 2014 11:51:51 -0600\r
22 X-Authority-Analysis: v=2.0 cv=ZZnDwLpA c=1 sm=2\r
23         a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
24         a=FVT5KAsjRlHC016-YJAA:9 a=EcQDfIwDZEqJA1f7rVUV8Q==:117\r
25 X-Telus-Outbound-IP: 207.102.88.62\r
26 From: Ian Main <imain@stemwinder.org>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: [PATCH] VIM: Make an option to save sent mail locally\r
29 Date: Mon,  6 Oct 2014 10:51:44 -0700\r
30 Message-Id: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
31 X-Mailer: git-send-email 1.9.3\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Mon, 06 Oct 2014 17:51:58 -0000\r
45 \r
46 Add an option to use 'notmuch insert' to save your sent mail.\r
47 ---\r
48  vim/notmuch.vim | 17 +++++++++++++++++\r
49  1 file changed, 17 insertions(+)\r
50 \r
51 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
52 index 331e930..cb280c3 100644\r
53 --- a/vim/notmuch.vim\r
54 +++ b/vim/notmuch.vim\r
55 @@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y'\r
56  let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S'\r
57  let s:notmuch_reader_default = 'mutt -f %s'\r
58  let s:notmuch_sendmail_default = 'sendmail'\r
59 +let s:notmuch_save_sent_locally_default = 1\r
60  let s:notmuch_folders_count_threads_default = 0\r
61  \r
62  function! s:new_file_buffer(type, fname)\r
63 @@ -108,6 +109,18 @@ EOF\r
64                 echohl None\r
65                 return\r
66         endif\r
67 +\r
68 +       if g:notmuch_save_sent_locally\r
69 +               let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread')\r
70 +               let err = v:shell_error\r
71 +               if err\r
72 +                       echohl Error\r
73 +                       echo 'Eeek! unable to save sent mail'\r
74 +                       echo out\r
75 +                       echohl None\r
76 +                       return\r
77 +               endif\r
78 +       endif\r
79         call delete(fname)\r
80         echo 'Mail sent successfully.'\r
81         call s:kill_this_buffer()\r
82 @@ -388,6 +401,10 @@ endfunction\r
83  "" root\r
84  \r
85  function! s:set_defaults()\r
86 +       if !exists('g:notmuch_save_sent_locally')\r
87 +               let g:notmuch_save_sent_locally = s:notmuch_save_sent_locally_default\r
88 +       endif\r
89 +\r
90         if !exists('g:notmuch_date_format')\r
91                 if exists('g:notmuch_rb_date_format')\r
92                         let g:notmuch_date_format = g:notmuch_rb_date_format\r
93 -- \r
94 1.9.3\r
95 \r