Re: [PATCH v4 09/16] index encrypted parts when asked.
[notmuch-archives.git] / b3 / c15f9a917a906ec7a193d55feb5b09877f75d8
1 Return-Path: <alpine.art.de@gmail.com>\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 19DCD431FAF\r
6         for <notmuch@notmuchmail.org>; Fri, 17 Oct 2014 09:14:21 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id GAbmhgcAx-Qy for <notmuch@notmuchmail.org>;\r
17         Fri, 17 Oct 2014 09:14:13 -0700 (PDT)\r
18 Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com\r
19  [74.125.82.41])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
20  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
21  CF62E431FB6    for <notmuch@notmuchmail.org>; Fri, 17 Oct 2014 09:14:12 -0700\r
22  (PDT)\r
23 Received: by mail-wg0-f41.google.com with SMTP id b13so1263713wgh.12\r
24         for <notmuch@notmuchmail.org>; Fri, 17 Oct 2014 09:14:11 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=date:message-id:from:to:cc:subject:in-reply-to:references\r
27         :mime-version:content-type:content-disposition\r
28         :content-transfer-encoding;\r
29         bh=erEWxFjw9iu1QcMHVxnSKtQAIZvTaJkx77deUjeygOs=;\r
30         b=T4W/80BJxAzMqJCaCXyKKzJMrzmM9FObAzFrGgTq6auggRfVoq7Ys3FhDDOHyRyBW8\r
31         ZDB2ZruySthKTswmVt4t+l2jp0qPcYGb0BLgDO6vx1B48HFCAlgkxTz4Wf+vaqi6awiV\r
32         k7ImI8ZgaBW2d/txfe2XjgrbvHNYJWWpKBxxqnBmxYKVBweUdY8DlvLcU35lZMgCJekk\r
33         YYQ4CJMGgMBTgVNMl/baerZLitz5XSbuzVPyLveL6qLXD0pHZS5eY5jr9x2TrPKr6u85\r
34         Jqafa4LBE+P6DzQOWzd7pSh3wxREUO+R3lVwRWZGhS/cUKDSbIjzrq4vtrc3+F0kziPh\r
35         WGjw==\r
36 X-Received: by 10.194.60.230 with SMTP id k6mr4277986wjr.135.1413562451607;\r
37         Fri, 17 Oct 2014 09:14:11 -0700 (PDT)\r
38 Received: from localhost (p5B00C8AC.dip0.t-ipconnect.de. [91.0.200.172])\r
39         by mx.google.com with ESMTPSA id ei1sm2567181wib.20.2014.10.17.09.14.10\r
40         for <multiple recipients>\r
41         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
42         Fri, 17 Oct 2014 09:14:10 -0700 (PDT)\r
43 Date: Fri, 17 Oct 2014 18:14:22 +0200\r
44 Message-ID: <20141017181422.GG20696@TP_L520.localdomain>\r
45 From: Franz Fellner <alpine.art.de@gmail.com>\r
46 To: Ian Main <imain@stemwinder.org>\r
47 Subject: Re: [PATCH] VIM: Add URI handling\r
48 In-Reply-To: <543ecc23bb98_2c291569e8c17@ovo.mains.priv.notmuch>\r
49 References: <1412281423-22441-1-git-send-email-imain@stemwinder.org>\r
50         <20141010114457.GG28601@TP_L520.localdomain>\r
51         <543822f73d3fd_46ad163fe88cd@ovo.mains.priv.notmuch>\r
52         <20141011142943.GD23373@TP_L520.localdomain>\r
53         <543ecc23bb98_2c291569e8c17@ovo.mains.priv.notmuch>\r
54 MIME-Version: 1.0\r
55 Content-Type: text/plain; charset=utf-8\r
56 Content-Disposition: inline\r
57 Content-Transfer-Encoding: 8bit\r
58 Cc: notmuch@notmuchmail.org\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Fri, 17 Oct 2014 16:14:21 -0000\r
72 \r
73 On Wed, 15 Oct 2014 12:33:55 -0700, Ian Main <imain@stemwinder.org> wrote:\r
74 > Franz Fellner wrote:\r
75 > > Here is a working implementation.\r
76 > > Please review carefully as I only can simulate ruby and vimscript\r
77 > > knowledge from what I see in notmuch.vim sourcefile and quick\r
78 > > googling.\r
79\r
80 > Yes, this works nicely.  Thanks!\r
81\r
82 > I do notice however that this is against the github plugin repo (I think)?\r
83 Yes, that's right.\r
84 I forked the notmuch repo on github and incorporated your patches.\r
85 Already made a mistake while applying one of your patches...\r
86 https://github.com/ff2000/notmuch\r
87 (Hope everythin is fine now)\r
88  \r
89 commit cb757e9e438341a7bc6d2cfec4de7bdcc85946ea\r
90 Author: Franz Fellner <alpine.art.de@gmail.com>\r
91 Date:   Fri Oct 17 11:19:41 2014 +0200\r
92 \r
93     VIM: Add MsgID to supported URIs\r
94 \r
95 diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
96 index 6287cf6..30e1876 100644\r
97 --- a/vim/notmuch.vim\r
98 +++ b/vim/notmuch.vim\r
99 @@ -268,6 +268,14 @@ ruby << EOF\r
100                 if uri.class == URI::MailTo\r
101                         vim_puts("Composing new email to #{uri.to}.")\r
102                         VIM::command("call s:compose('#{uri.to}')")\r
103 +               elsif uri.class == URI::MsgID\r
104 +                       msg = $curbuf.message(uri.opaque)\r
105 +                       if !msg\r
106 +                               vim_puts("Message not found in NotMuch database: #{uri.to_s}")\r
107 +                       else\r
108 +                               vim_puts("Opening message #{msg.message_id} in thread #{msg.thread_id}.")\r
109 +                               VIM::command("call s:show('thread:#{msg.thread_id}', '#{msg.message_id}')")\r
110 +                       end\r
111                 else\r
112                         vim_puts("Opening #{uri.to_s}.")\r
113                         cmd = VIM::evaluate('g:notmuch_open_uri')\r
114 @@ -428,11 +436,12 @@ endfunction\r
115  \r
116  "" main\r
117  \r
118 -function! s:show(thread_id)\r
119 +function! s:show(thread_id, msg_id)\r
120         call s:new_buffer('show')\r
121         setlocal modifiable\r
122  ruby << EOF\r
123         thread_id = VIM::evaluate('a:thread_id')\r
124 +       msg_id = VIM::evaluate('a:msg_id')\r
125         $cur_thread = thread_id\r
126         $messages.clear\r
127         $curbuf.render do |b|\r
128 @@ -464,6 +473,9 @@ ruby << EOF\r
129                         end\r
130                         b << ""\r
131                         nm_m.end = b.count\r
132 +                       if !msg_id.empty? and nm_m.message_id == msg_id\r
133 +                               VIM::command("normal #{nm_m.start}zt")\r
134 +                       end\r
135                 end\r
136                 b.delete(b.count)\r
137         end\r
138 @@ -486,7 +498,7 @@ ruby << EOF\r
139         when 1; $cur_filter = nil\r
140         when 2; $cur_filter = $cur_search\r
141         end\r
142 -       VIM::command("call s:show('#{id}')")\r
143 +       VIM::command("call s:show('#{id}', '')")\r
144  EOF\r
145  endfunction\r
146  \r
147 @@ -910,6 +922,10 @@ ruby << EOF\r
148                         q\r
149                 end\r
150  \r
151 +               def message(id)\r
152 +                       @db.find_message(id)\r
153 +               end\r
154 +\r
155                 def close\r
156                         @queries.delete_if { |q| ! q.destroy! }\r
157                         @db.close\r
158 @@ -930,6 +946,13 @@ ruby << EOF\r
159                 end\r
160         end\r
161  \r
162 +       module URI\r
163 +               class MsgID < Generic\r
164 +               end\r
165 +\r
166 +               @@schemes['ID'] = MsgID\r
167 +       end\r
168 +\r
169         class Message\r
170                 attr_accessor :start, :body_start, :end\r
171                 attr_reader :message_id, :filename, :mail\r