Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / e9 / eb3a31c0b1eb632d08f27983fe4405f55c50f4
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 1701A431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 10:59:03 -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 k0W4zZ1vQnvP for <notmuch@notmuchmail.org>;\r
16         Mon, 20 Oct 2014 10:58:57 -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 740D8431FAE\r
19         for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 10:58:57 -0700 (PDT)\r
20 Received: from ovo.mains.priv ([207.102.88.62]) by cmta9.telus.net with TELUS\r
21         id 5Vyv1p0051LiWEf01Vyv7a; Mon, 20 Oct 2014 11:58:56 -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=a8Ndk92kl3mRpADGGBkA: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 v2] VIM: Make an option to save sent mail locally\r
29 Date: Mon, 20 Oct 2014 10:58:50 -0700\r
30 Message-Id: <1413827930-2493-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, 20 Oct 2014 17:59:03 -0000\r
47 \r
48 Add an option to use 'notmuch insert' to save your sent mail.\r
49 ---\r
50 \r
51 This update changes the 'system' line and adds a sent mailbox\r
52 option.\r
53 \r
54  vim/notmuch.vim | 22 ++++++++++++++++++++++\r
55  1 file changed, 22 insertions(+)\r
56 \r
57 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
58 index 331e930..b0c6ebd 100644\r
59 --- a/vim/notmuch.vim\r
60 +++ b/vim/notmuch.vim\r
61 @@ -58,6 +58,8 @@ let s:notmuch_date_format_default = '%d.%m.%y'\r
62  let s:notmuch_datetime_format_default = '%d.%m.%y %H:%M:%S'\r
63  let s:notmuch_reader_default = 'mutt -f %s'\r
64  let s:notmuch_sendmail_default = 'sendmail'\r
65 +let s:notmuch_save_sent_locally_default = 1\r
66 +let s:notmuch_save_sent_mailbox_default = 'Sent'\r
67  let s:notmuch_folders_count_threads_default = 0\r
68  \r
69  function! s:new_file_buffer(type, fname)\r
70 @@ -108,6 +110,18 @@ EOF\r
71                 echohl None\r
72                 return\r
73         endif\r
74 +\r
75 +       if g:notmuch_save_sent_locally\r
76 +               let out = system('notmuch insert --create-folder --folder=' . g:notmuch_save_sent_mailbox . ' +sent -unread -inbox < ' . fname)\r
77 +               let err = v:shell_error\r
78 +               if err\r
79 +                       echohl Error\r
80 +                       echo 'Eeek! unable to save sent mail'\r
81 +                       echo out\r
82 +                       echohl None\r
83 +                       return\r
84 +               endif\r
85 +       endif\r
86         call delete(fname)\r
87         echo 'Mail sent successfully.'\r
88         call s:kill_this_buffer()\r
89 @@ -388,6 +402,14 @@ endfunction\r
90  "" root\r
91  \r
92  function! s:set_defaults()\r
93 +       if !exists('g:notmuch_save_sent_locally')\r
94 +               let g:notmuch_save_sent_locally = s:notmuch_save_sent_locally_default\r
95 +       endif\r
96 +\r
97 +       if !exists('g:notmuch_save_sent_mailbox')\r
98 +               let g:notmuch_save_sent_mailbox = s:notmuch_save_sent_mailbox_default\r
99 +       endif\r
100 +\r
101         if !exists('g:notmuch_date_format')\r
102                 if exists('g:notmuch_rb_date_format')\r
103                         let g:notmuch_date_format = g:notmuch_rb_date_format\r
104 -- \r
105 1.9.3\r
106 \r