Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 4e / c6cef5e8e9ba30fee092bb27e630a5f585e546
1 Return-Path: <telenczuk@unic.cnrs-gif.fr>\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 CB5B5429E4B\r
6         for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:03:36 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 2.438\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 Z9kNyH+GDWUS for <notmuch@notmuchmail.org>;\r
16         Sat, 10 Jan 2015 04:03:34 -0800 (PST)\r
17 Received: from smtp.webfaction.com (mail6.webfaction.com [74.55.86.74])\r
18         by olra.theworths.org (Postfix) with ESMTP id 0C336429E44\r
19         for <notmuch@notmuchmail.org>; Sat, 10 Jan 2015 04:03:34 -0800 (PST)\r
20 Received: from localhost (87-231-242-54.rev.numericable.fr [87.231.242.54])\r
21         by smtp.webfaction.com (Postfix) with ESMTP id 776BC59A3AC5;\r
22         Sat, 10 Jan 2015 12:03:33 +0000 (UTC)\r
23 From: Bartosz <telenczuk@unic.cnrs-gif.fr>\r
24 To: notmuch@notmuchmail.org\r
25 Subject: [PATCH 3/4] VIM: save sent message to maildir\r
26 Date: Sat, 10 Jan 2015 13:03:03 +0100\r
27 Message-Id: <1420891384-992-4-git-send-email-telenczuk@unic.cnrs-gif.fr>\r
28 X-Mailer: git-send-email 1.9.3 (Apple Git-50)\r
29 In-Reply-To: <1420891384-992-1-git-send-email-telenczuk@unic.cnrs-gif.fr>\r
30 References: <1420891384-992-1-git-send-email-telenczuk@unic.cnrs-gif.fr>\r
31 X-Mailman-Approved-At: Sat, 10 Jan 2015 10:22:23 -0800\r
32 Cc: Bartosz <telenczuk@unic.cnrs-gif.fr>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sat, 10 Jan 2015 12:03:37 -0000\r
46 \r
47 maildir folder is slected based on the address in\r
48 from header and it is configurable via notmuch\r
49 config.\r
50 ---\r
51  vim/notmuch.vim | 20 ++++++++++++++++++++\r
52  1 file changed, 20 insertions(+)\r
53 \r
54 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
55 index 4f90d79..e95db4d 100644\r
56 --- a/vim/notmuch.vim\r
57 +++ b/vim/notmuch.vim\r
58 @@ -110,6 +110,9 @@ EOF\r
59                 echohl None\r
60                 return\r
61         endif\r
62 +\r
63 +       call s:save_to_sent(fname)\r
64 +\r
65         call delete(fname)\r
66         echo 'Mail sent successfully.'\r
67         call s:kill_this_buffer()\r
68 @@ -257,6 +260,20 @@ function! s:folders_refresh()\r
69         setlocal nomodifiable\r
70  endfunction\r
71  \r
72 +function! s:save_to_sent(fname)\r
73 +ruby << EOF\r
74 +    if $sent_dirs\r
75 +               fname = VIM::evaluate('a:fname')\r
76 +               m = Mail.read(fname)\r
77 +               from_address = m.from[0]\r
78 +               sent_box = $sent_dirs[from_address]\r
79 +               if sent_box\r
80 +                       system "notmuch insert --folder:#{sent_box} +sent < #{fname}"\r
81 +               end\r
82 +       end\r
83 +EOF\r
84 +endfunction\r
85 +\r
86  "" basic\r
87  \r
88  function! s:show_cursor_moved()\r
89 @@ -505,6 +522,8 @@ ruby << EOF\r
90                 $email_address = get_config_item('user.primary_email')\r
91                 $email_name = get_config_item('user.name')\r
92                 $email = "%s <%s>" % [$email_name, $email_address]\r
93 +               sent_dirs_config = get_config_item('vim.sent_dirs')\r
94 +               $sent_dirs = Hash[sent_dirs_config.split("\n").collect{|x| x.strip.split("=>")}]\r
95         end\r
96  \r
97         def vim_puts(s)\r
98 @@ -698,6 +717,7 @@ ruby << EOF\r
99                 end\r
100         end\r
101  \r
102 +\r
103         module DbHelper\r
104                 def init(name)\r
105                         @name = name\r
106 -- \r
107 1.9.3 (Apple Git-50)\r
108 \r