Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2c / 04baa1819c21316ebe69fa2fe4360be2397fef
1 Return-Path: <tomi.ollila@iki.fi>\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 0C550431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 12:05:56 -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 tests=[none]\r
12         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 Ex0-5RiIuOVR for <notmuch@notmuchmail.org>;\r
16         Mon, 20 Oct 2014 12:05:52 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 1F60C431FAE\r
19         for <notmuch@notmuchmail.org>; Mon, 20 Oct 2014 12:05:52 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id ADE0B10008C;\r
22         Mon, 20 Oct 2014 22:05:32 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Franz Fellner <alpine.art.de@gmail.com>\r
25 Subject: Re: [PATCH] VIM: Add URI handling\r
26 In-Reply-To: <20141017181422.GG20696@TP_L520.localdomain>\r
27 References: <1412281423-22441-1-git-send-email-imain@stemwinder.org>\r
28         <20141010114457.GG28601@TP_L520.localdomain>\r
29         <543822f73d3fd_46ad163fe88cd@ovo.mains.priv.notmuch>\r
30         <20141011142943.GD23373@TP_L520.localdomain>\r
31         <543ecc23bb98_2c291569e8c17@ovo.mains.priv.notmuch>\r
32         <20141017181422.GG20696@TP_L520.localdomain>\r
33 User-Agent: Notmuch/0.18.1+130~ga61922f (http://notmuchmail.org) Emacs/24.3.1\r
34         (x86_64-unknown-linux-gnu)\r
35 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
36         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
37         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
38 Date: Mon, 20 Oct 2014 22:05:32 +0300\r
39 Message-ID: <m2vbner283.fsf@guru.guru-group.fi>\r
40 MIME-Version: 1.0\r
41 Content-Type: text/plain\r
42 Cc: notmuch@notmuchmail.org\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Mon, 20 Oct 2014 19:05:56 -0000\r
56 \r
57 On Fri, Oct 17 2014, Franz Fellner <alpine.art.de@gmail.com> wrote:\r
58 \r
59 > On Wed, 15 Oct 2014 12:33:55 -0700, Ian Main <imain@stemwinder.org> wrote:\r
60 >> Franz Fellner wrote:\r
61 >> > Here is a working implementation.\r
62 >> > Please review carefully as I only can simulate ruby and vimscript\r
63 >> > knowledge from what I see in notmuch.vim sourcefile and quick\r
64 >> > googling.\r
65 >> \r
66 >> Yes, this works nicely.  Thanks!\r
67 >> \r
68 >> I do notice however that this is against the github plugin repo (I think)?\r
69 > Yes, that's right.\r
70 > I forked the notmuch repo on github and incorporated your patches.\r
71 > Already made a mistake while applying one of your patches...\r
72 > https://github.com/ff2000/notmuch\r
73 > (Hope everythin is fine now)\r
74 >  \r
75 > commit cb757e9e438341a7bc6d2cfec4de7bdcc85946ea\r
76 > Author: Franz Fellner <alpine.art.de@gmail.com>\r
77 > Date:   Fri Oct 17 11:19:41 2014 +0200\r
78 >\r
79 >     VIM: Add MsgID to supported URIs\r
80 \r
81 Code-wise this patch looks good -- although I am not entirely sure what id\r
82 does -- I expect it to handle id:... links...\r
83 \r
84 This email applies with git am (on top of Ian's) but the commit message has\r
85 quite a few lines of cruft -- I'd like to see a commit message what\r
86 explains what this change do ( the term 'MsgID' seems to be some vim client\r
87 internal (subclass in URI class ?) which IMO should be better commented in\r
88 this commit message.\r
89 \r
90 \r
91 Tomi\r
92 \r
93 >\r
94 > diff --git a/vim/notmuch.vim b/vim/notmuch.vim\r
95 > index 6287cf6..30e1876 100644\r
96 > --- a/vim/notmuch.vim\r
97 > +++ b/vim/notmuch.vim\r
98 > @@ -268,6 +268,14 @@ ruby << EOF\r
99 >               if uri.class == URI::MailTo\r
100 >                       vim_puts("Composing new email to #{uri.to}.")\r
101 >                       VIM::command("call s:compose('#{uri.to}')")\r
102 > +             elsif uri.class == URI::MsgID\r
103 > +                     msg = $curbuf.message(uri.opaque)\r
104 > +                     if !msg\r
105 > +                             vim_puts("Message not found in NotMuch database: #{uri.to_s}")\r
106 > +                     else\r
107 > +                             vim_puts("Opening message #{msg.message_id} in thread #{msg.thread_id}.")\r
108 > +                             VIM::command("call s:show('thread:#{msg.thread_id}', '#{msg.message_id}')")\r
109 > +                     end\r
110 >               else\r
111 >                       vim_puts("Opening #{uri.to_s}.")\r
112 >                       cmd = VIM::evaluate('g:notmuch_open_uri')\r
113 > @@ -428,11 +436,12 @@ endfunction\r
114 >  \r
115 >  "" main\r
116 >  \r
117 > -function! s:show(thread_id)\r
118 > +function! s:show(thread_id, msg_id)\r
119 >       call s:new_buffer('show')\r
120 >       setlocal modifiable\r
121 >  ruby << EOF\r
122 >       thread_id = VIM::evaluate('a:thread_id')\r
123 > +     msg_id = VIM::evaluate('a:msg_id')\r
124 >       $cur_thread = thread_id\r
125 >       $messages.clear\r
126 >       $curbuf.render do |b|\r
127 > @@ -464,6 +473,9 @@ ruby << EOF\r
128 >                       end\r
129 >                       b << ""\r
130 >                       nm_m.end = b.count\r
131 > +                     if !msg_id.empty? and nm_m.message_id == msg_id\r
132 > +                             VIM::command("normal #{nm_m.start}zt")\r
133 > +                     end\r
134 >               end\r
135 >               b.delete(b.count)\r
136 >       end\r
137 > @@ -486,7 +498,7 @@ ruby << EOF\r
138 >       when 1; $cur_filter = nil\r
139 >       when 2; $cur_filter = $cur_search\r
140 >       end\r
141 > -     VIM::command("call s:show('#{id}')")\r
142 > +     VIM::command("call s:show('#{id}', '')")\r
143 >  EOF\r
144 >  endfunction\r
145 >  \r
146 > @@ -910,6 +922,10 @@ ruby << EOF\r
147 >                       q\r
148 >               end\r
149 >  \r
150 > +             def message(id)\r
151 > +                     @db.find_message(id)\r
152 > +             end\r
153 > +\r
154 >               def close\r
155 >                       @queries.delete_if { |q| ! q.destroy! }\r
156 >                       @db.close\r
157 > @@ -930,6 +946,13 @@ ruby << EOF\r
158 >               end\r
159 >       end\r
160 >  \r
161 > +     module URI\r
162 > +             class MsgID < Generic\r
163 > +             end\r
164 > +\r
165 > +             @@schemes['ID'] = MsgID\r
166 > +     end\r
167 > +\r
168 >       class Message\r
169 >               attr_accessor :start, :body_start, :end\r
170 >               attr_reader :message_id, :filename, :mail\r
171 > _______________________________________________\r
172 > notmuch mailing list\r
173 > notmuch@notmuchmail.org\r
174 > http://notmuchmail.org/mailman/listinfo/notmuch\r