Re: notmuch-tree display
[notmuch-archives.git] / 8e / fbf217dcd43b8bc4ce22258fc7de8e6d39c198
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 52576431FBC\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 11:10:45 -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 oawazNFRnSiG for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Oct 2014 11:10:39 -0700 (PDT)\r
17 Received: from cmta9.telus.net (cmta9.telus.net [209.171.16.82])\r
18         by olra.theworths.org (Postfix) with ESMTP id B7208431FAE\r
19         for <notmuch@notmuchmail.org>; Mon,  6 Oct 2014 11:10:39 -0700 (PDT)\r
20 Received: from ovo.mains.priv ([207.102.88.62]) by cmta9.telus.net with TELUS\r
21         id zuAe1o05H1LiWEf01uAehs; Mon, 06 Oct 2014 12:10:39 -0600\r
22 X-Authority-Analysis: v=2.0 cv=KNmE+i5o c=1 sm=2\r
23         a=EcQDfIwDZEqJA1f7rVUV8Q==:17 a=S-IsBHyFrF4A:10 a=tsa3CZZnAAAA:8\r
24         a=Z2xPzeXNZ0CE_Iho6mIA: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 11:10:36 -0700\r
30 Message-Id: <1412619036-29203-1-git-send-email-imain@stemwinder.org>\r
31 X-Mailer: git-send-email 1.9.3\r
32 In-Reply-To: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
33 References: <1412617904-27252-1-git-send-email-imain@stemwinder.org>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Mon, 06 Oct 2014 18:10:45 -0000\r
47 \r
48 Add an option to use 'notmuch insert' to save your sent mail.\r
49 ---\r
50 \r
51 Add -inbox as well.\r
52 \r
53  vim/notmuch.vim | 17 +++++++++++++++++\r
54  1 file changed, 17 insertions(+)\r
55 \r
56 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
57 index 331e930..a9044c4 100644\r
58 --- a/vim/notmuch.vim\r
59 +++ b/vim/notmuch.vim\r
60 @@ -58,6 +58,7 @@ let s:notmuch_date_format_default = '%d.%m.%y'\r
61  let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S'\r
62  let s:notmuch_reader_default = 'mutt -f %s'\r
63  let s:notmuch_sendmail_default = 'sendmail'\r
64 +let s:notmuch_save_sent_locally_default = 1\r
65  let s:notmuch_folders_count_threads_default = 0\r
66  \r
67  function! s:new_file_buffer(type, fname)\r
68 @@ -108,6 +109,18 @@ EOF\r
69                 echohl None\r
70                 return\r
71         endif\r
72 +\r
73 +       if g:notmuch_save_sent_locally\r
74 +               let out = system('cat ' . fname . ' | notmuch insert --create-folder --folder=Sent +sent -unread -inbox')\r
75 +               let err = v:shell_error\r
76 +               if err\r
77 +                       echohl Error\r
78 +                       echo 'Eeek! unable to save sent mail'\r
79 +                       echo out\r
80 +                       echohl None\r
81 +                       return\r
82 +               endif\r
83 +       endif\r
84         call delete(fname)\r
85         echo 'Mail sent successfully.'\r
86         call s:kill_this_buffer()\r
87 @@ -388,6 +401,10 @@ endfunction\r
88  "" root\r
89  \r
90  function! s:set_defaults()\r
91 +       if !exists('g:notmuch_save_sent_locally')\r
92 +               let g:notmuch_save_sent_locally = s:notmuch_save_sent_locally_default\r
93 +       endif\r
94 +\r
95         if !exists('g:notmuch_date_format')\r
96                 if exists('g:notmuch_rb_date_format')\r
97                         let g:notmuch_date_format = g:notmuch_rb_date_format\r
98 -- \r
99 1.9.3\r
100 \r