Franz Fellner wrote: > Here is a working implementation. > Please review carefully as I only can simulate ruby and vimscript > knowledge from what I see in notmuch.vim sourcefile and quick > googling. Yes, this works nicely. Thanks! I do notice however that this is against the github plugin repo (I think)? I think It'd be nice to have this against the main repo and in its own thread. I can repost it for you if you like as I added it to mine, or you can do it if you prefer. Ian > Regards > Franz > > > diff --git a/plugin/notmuch.vim b/plugin/notmuch.vim > index 567f75c..ef9fefa 100644 > --- a/plugin/notmuch.vim > +++ b/plugin/notmuch.vim > @@ -269,6 +269,14 @@ ruby << EOF > if uri.class == URI::MailTo > vim_puts("Composing new email to #{uri.to}.") > VIM::command("call s:compose('#{uri.to}')") > + elsif uri.class == URI::MsgID > + msg = $curbuf.message(uri.opaque) > + if !msg > + vim_puts("Message not found in NotMuch database: #{uri.to_s}") > + else > + vim_puts("Opening message #{msg.message_id} in thread #{msg.thread_id}.") > + VIM::command("call s:show('thread:#{msg.thread_id}', '#{msg.message_id}')") > + end > else > vim_puts("Opening #{uri.to_s}.") > cmd = VIM::evaluate('g:notmuch_open_uri') > @@ -429,11 +437,12 @@ endfunction > > "" main > > -function! s:show(thread_id) > +function! s:show(thread_id, msg_id) > call s:new_buffer('show') > setlocal modifiable > ruby << EOF > thread_id = VIM::evaluate('a:thread_id') > + msg_id = VIM::evaluate('a:msg_id') > $cur_thread = thread_id > $messages.clear > $curbuf.render do |b| > @@ -465,6 +474,9 @@ ruby << EOF > end > b << "" > nm_m.end = b.count > + if msg_id and nm_m.message_id == msg_id > + VIM::command("normal #{nm_m.start}zt") > + end > end > b.delete(b.count) > end > @@ -487,7 +499,7 @@ ruby << EOF > when 1; $cur_filter = nil > when 2; $cur_filter = $cur_search > end > - VIM::command("call s:show('#{id}')") > + VIM::command("call s:show('#{id}', '')") > EOF > endfunction > > @@ -917,6 +929,10 @@ ruby << EOF > q > end > > + def message(id) > + @db.find_message(id) > + end > + > def close > @queries.delete_if { |q| ! q.destroy! } > @db.close > @@ -937,12 +953,20 @@ ruby << EOF > end > end > > + module URI > + class MsgID < Generic > + end > + > + @@schemes['ID'] = MsgID > + end > + > class Message > attr_accessor :start, :body_start, :end > - attr_reader :message_id, :filename, :mail > + attr_reader :message_id, :thread_id, :filename, :mail > > def initialize(msg, mail) > @message_id = msg.message_id > + @thread_id = msg.thread_id > @filename = msg.filename > @mail = mail > @start = 0 > > On Fri, 10 Oct 2014 11:18:31 -0700, Ian Main <imain@stemwinder.org> wrote: > > Franz Fellner wrote: > > > Works nice. Tested with an https and a mailto URI. > > > But it would be awesome if you could add message id handling, So one > > > could easily navigate to linked messages. I only found emacs client > > > implement this feature. What I read in the docs about ruby URI module > > > it should be fairly easy to add a custom scheme for id. > > > > I'm afraid I'm not sure what you mean by message id handling? It's > > probably something simple but .. :) > > > > Ian