From: Felipe Contreras Date: Fri, 4 May 2012 11:55:15 +0000 (+0200) Subject: Re: [ANN] New awesome vim plug-in using Ruby bindings X-Git-Url: http://git.tremily.us/?p=notmuch-archives.git;a=commitdiff_plain;h=058a169a7cb22c2839cc5c379437fb9e9bead4e1 Re: [ANN] New awesome vim plug-in using Ruby bindings --- diff --git a/ad/8e0cc051d53e79560e573e473258c321f669aa b/ad/8e0cc051d53e79560e573e473258c321f669aa new file mode 100644 index 000000000..4057e4112 --- /dev/null +++ b/ad/8e0cc051d53e79560e573e473258c321f669aa @@ -0,0 +1,92 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 27C85431FB6 + for ; Fri, 4 May 2012 04:55:18 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id dqJ5kryalnPp for ; + Fri, 4 May 2012 04:55:17 -0700 (PDT) +Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 356B0431FAE for ; Fri, 4 May 2012 04:55:17 -0700 + (PDT) +Received: by wgbdt14 with SMTP id dt14so2157699wgb.2 + for ; Fri, 04 May 2012 04:55:15 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=mime-version:in-reply-to:references:date:message-id:subject:from:to + :cc:content-type:content-transfer-encoding; + bh=O+EqIGNwd0CIMA/5IjmMf+HmL8+mDIxg3nNAuL1gC90=; + b=F+tdCIf0pgrYv0yAPdD5IVmfB9jD1oJVkAQf0CGt5puC2osRKbmE7dYtkU/29tXmv6 + rFppCvoL0VyTWV63JZ/DYhkEX18nhzPYC7v9myOLejEZo+1Q4HLlCddtmCcS13Nm6zyo + Jgp8J62VROjX8yDlJW8AJRcLMUUgx7kcOVILwF2rL1RFFmYgGwWSWrnIUE1TkTPhJ3ja + VzauTnIRncxNVP2VttgIvhDjVtQYFoJA5sShb5sl0SIPWlwcE1BKokz6SBlLSQIrHdHR + ANhFti8MedRyIrH3YRY/GksrgvHWNjrbC5x9vL0Qn6gXLsUzzY0BW+ETEd+NLb9FzFAd + BI9g== +MIME-Version: 1.0 +Received: by 10.180.107.101 with SMTP id hb5mr12363336wib.7.1336132515827; + Fri, 04 May 2012 04:55:15 -0700 (PDT) +Received: by 10.216.124.197 with HTTP; Fri, 4 May 2012 04:55:15 -0700 (PDT) +In-Reply-To: <20120502204148.4214.85824@daenerys.khirnov.net> +References: + + <20120502204148.4214.85824@daenerys.khirnov.net> +Date: Fri, 4 May 2012 13:55:15 +0200 +Message-ID: + +Subject: Re: [ANN] New awesome vim plug-in using Ruby bindings +From: Felipe Contreras +To: Anton Khirnov +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 04 May 2012 11:55:18 -0000 + +On Wed, May 2, 2012 at 10:41 PM, Anton Khirnov wrote: +> +> On Mon, 23 Apr 2012 04:12:32 +0300, Felipe Contreras wrote: + +>> =C2=A0* Gradual searches; you don't have to wait for the whole search to= + finish, +>> =C2=A0 =C2=A0sort 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. + +--=20 +Felipe Contreras