Re: [ANN] New awesome vim plug-in using Ruby bindings

Subject: Re: [ANN] New awesome vim plug-in using Ruby bindings

Date: Fri, 4 May 2012 13:55:15 +0200

To: Anton Khirnov

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Wed, May 2, 2012 at 10:41 PM, Anton Khirnov <anton@khirnov.net> wrote:
>
> On Mon, 23 Apr 2012 04:12:32 +0300, Felipe Contreras <felipe.contreras@gmail.com> wrote:

>>  * Gradual searches; you don't have to wait for the whole search to finish,
>>    sort of like the 'less' command
>
> How did you do that? When I tried to do this in my version, I got hit by
> vim not being threadsafe.

I first started with Ruby fibers, but stumbled upon a bug, and then I
realized I didn't actually need them; in Ruby there is an Enumerable
class, which the Notmuch::Threads class includes, and one of the
methods allows to get only a certain number of items, so regardless of
what happens in the back, I only get a certain number of items at a
time. This is particularly easy thanks to Ruby blocks, but I guess you
can achieve the same in Python somehow.

Each time the cursor changes I check if a certain threshold of items
has been passed, and if so, get one more chunk.

Cheers.

-- 
Felipe Contreras

Thread: