From: Ian Main <imain@stemwinder.org>
To: Franz Fellner <alpine.art.de@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH] VIM: Add URI handling
Date: Mon, 20 Oct 2014 10:45:29 -0700 [thread overview]
Message-ID: <54454a39e0a1_6dc1435e9496@ovo.mains.priv.notmuch> (raw)
In-Reply-To: <20141017181422.GG20696@TP_L520.localdomain>
Franz Fellner wrote:
> On Wed, 15 Oct 2014 12:33:55 -0700, Ian Main <imain@stemwinder.org> wrote:
> > 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)?
> Yes, that's right.
> I forked the notmuch repo on github and incorporated your patches.
> Already made a mistake while applying one of your patches...
> https://github.com/ff2000/notmuch
> (Hope everythin is fine now)
>
> commit cb757e9e438341a7bc6d2cfec4de7bdcc85946ea
> Author: Franz Fellner <alpine.art.de@gmail.com>
> Date: Fri Oct 17 11:19:41 2014 +0200
>
> VIM: Add MsgID to supported URIs
>
> diff --git a/vim/notmuch.vim b/vim/notmuch.vim
> index 6287cf6..30e1876 100644
> --- a/vim/notmuch.vim
> +++ b/vim/notmuch.vim
> @@ -268,6 +268,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')
> @@ -428,11 +436,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|
> @@ -464,6 +473,9 @@ ruby << EOF
> end
> b << ""
> nm_m.end = b.count
> + if !msg_id.empty? and nm_m.message_id == msg_id
> + VIM::command("normal #{nm_m.start}zt")
> + end
> end
> b.delete(b.count)
> end
> @@ -486,7 +498,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
>
> @@ -910,6 +922,10 @@ ruby << EOF
> q
> end
>
> + def message(id)
> + @db.find_message(id)
> + end
> +
> def close
> @queries.delete_if { |q| ! q.destroy! }
> @db.close
> @@ -930,6 +946,13 @@ 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
LGTM! Nice addition.
Ian
next prev parent reply other threads:[~2014-10-20 17:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 20:23 [PATCH] VIM: Add URI handling Ian Main
2014-10-10 9:44 ` Franz Fellner
2014-10-10 18:18 ` Ian Main
2014-10-11 12:29 ` Franz Fellner
2014-10-15 19:33 ` Ian Main
2014-10-17 16:14 ` Franz Fellner
2014-10-20 17:45 ` Ian Main [this message]
2014-10-20 19:05 ` Tomi Ollila
2014-10-20 19:38 ` Franz Fellner
2014-10-21 14:25 ` Tomi Ollila
2014-10-20 18:53 ` Tomi Ollila
2014-10-23 22:19 ` [PATCH v2] " Ian Main
2014-10-24 9:52 ` Tomi Ollila
2014-10-24 16:11 ` [PATCH v3] " Ian Main
2014-10-24 16:30 ` Tomi Ollila
2014-10-24 17:03 ` Ian Main
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54454a39e0a1_6dc1435e9496@ovo.mains.priv.notmuch \
--to=imain@stemwinder.org \
--cc=alpine.art.de@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).