From c3971a95045f09ebf5c24f0141b65aea4c690f12 Mon Sep 17 00:00:00 2001 From: Sergei Shilovsky Date: Tue, 7 Oct 2014 18:04:09 +0400 Subject: [PATCH] Re: Backward scrolling notmuch_messages_t and notmuch_threads_t --- f5/a876c963976aaff70704510819da75985ba08f | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 f5/a876c963976aaff70704510819da75985ba08f diff --git a/f5/a876c963976aaff70704510819da75985ba08f b/f5/a876c963976aaff70704510819da75985ba08f new file mode 100644 index 000000000..80590ae60 --- /dev/null +++ b/f5/a876c963976aaff70704510819da75985ba08f @@ -0,0 +1,130 @@ +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 0A0DE431FB6 + for ; Tue, 7 Oct 2014 07:04: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 EKLn6RV07Tl9 for ; + Tue, 7 Oct 2014 07:04:10 -0700 (PDT) +Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com + [209.85.218.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B42D0431FAF + for ; Tue, 7 Oct 2014 07:04:10 -0700 (PDT) +Received: by mail-oi0-f52.google.com with SMTP id a3so5217253oib.11 + for ; Tue, 07 Oct 2014 07:04:10 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=mime-version:reply-to:in-reply-to:references:date:message-id + :subject:from:to:cc:content-type:content-transfer-encoding; + bh=+AatGbCyyrCfWm9m+zgIozJNs8d4k+V0mYYoJ/LrpbQ=; + b=NV5G8ugAvX7FTLUZ25Q2P6OtWV3VwHPFKZs8Q18h65hW2EvF1Kyc6zOPpTUo8r7d/L + aVjWWcSmlQEZUKTy3MZr0MRfLhmm7UKv1HiPyx4JzhYhfmDECblA/ypE2O/1/dPLPxiK + QAsUJ27QqRmx09gK56WbUVdh0+bSI+SHONYKx41m33/df7Oo0Swdwdg19uG93oFb7F2d + h5eAWdyEfl4VXJUf4T7R99pNrIj6jzCrlHfiB+iGZixZa75mNNy6yZtsgRDO6kirb0IU + r/vTZc9izeUDvCwkWakYfTfvrLy2PJnhEOv6+5MDqS/WXajyNf6pCHs6/dBz8ted3NLB + Pong== +MIME-Version: 1.0 +X-Received: by 10.182.236.65 with SMTP id us1mr4373287obc.38.1412690649854; + Tue, 07 Oct 2014 07:04:09 -0700 (PDT) +Received: by 10.76.41.3 with HTTP; Tue, 7 Oct 2014 07:04:09 -0700 (PDT) +In-Reply-To: <87lhos5duu.fsf@nikula.org> +References: + + <87lhos5duu.fsf@nikula.org> +Date: Tue, 7 Oct 2014 18:04:09 +0400 +Message-ID: + +Subject: Re: Backward scrolling notmuch_messages_t and notmuch_threads_t +From: Sergei Shilovsky +To: Jani Nikula +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 +Reply-To: sshilovsky@gmail.com +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 07 Oct 2014 14:04:18 -0000 + +notmuch search --offset` simply skips the number of threads/messages. +This is not so fast if the offset is large. + + 98 for (i =3D 0; + 99 notmuch_threads_valid (threads) && (limit < 0 || i < +offset + limit ); +100 notmuch_threads_move_to_next (threads), i++) +101 { +102 thread =3D notmuch_threads_get (threads); +103 +104 if (i < offset) { +105 notmuch_thread_destroy (thread); +106 continue; +107 } + +On Tue, Oct 7, 2014 at 3:16 PM, Jani Nikula wrote: +> On Tue, 07 Oct 2014, Sergei Shilovsky wrote: +>> Lets consider messages first. +>> +>> As far as I get there is no straightforward +>> notmuch_messages_move_to_previous. One can usually implement such +>> behaviour with caching previous messages which is slightly inefficient +>> in memory consumption terms. +>> +>> But we can sort messages either date asc or date desc. +>> +>> Suppose, we're currently at the 1000th message in query "tag:whatever". +>> +>> So if we need to go to the previous message we could do something like +>> +>> notmuch search --sort=3Doldest-first tag:whatever and \ +>> date:.. +>> +>> This query's result should start with our 1000th message following its +>> previous message (in terms of the original request). So backward +>> scrolling with no cache looks to be at least possible. +>> +>> Any idea of would that be fine? Is it possible to implement similar +>> thing at low-level? +> +> See notmuch search --offset=3DN and --limit=3DN options. +> +> BR, +> Jani. +> +> +>> +>> -- +>> =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, +>> =D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9 =D0=A8=D0=B8=D0=BB=D0=BE=D0=B2=D1= +=81=D0=BA=D0=B8=D0=B9 +>> Sergei Shilovsky +>> _______________________________________________ +>> notmuch mailing list +>> notmuch@notmuchmail.org +>> http://notmuchmail.org/mailman/listinfo/notmuch + + + +--=20 +=D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, +=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9 =D0=A8=D0=B8=D0=BB=D0=BE=D0=B2=D1=81= +=D0=BA=D0=B8=D0=B9 +Sergei Shilovsky -- 2.26.2