Backward scrolling notmuch_messages_t and notmuch_threads_t

Sergei Shilovsky sshilovsky at gmail.com
Tue Oct 7 07:04:09 PDT 2014


notmuch search --offset` simply skips the number of threads/messages.
This is not so fast if the offset is large.

 98     for (i = 0;
 99          notmuch_threads_valid (threads) && (limit < 0 || i <
offset + limit    );
100          notmuch_threads_move_to_next (threads), i++)
101     {
102         thread = 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 <jani at nikula.org> wrote:
> On Tue, 07 Oct 2014, Sergei Shilovsky <sshilovsky at gmail.com> 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=oldest-first tag:whatever and \
>>         date:..<here is the date of the 1000th message>
>>
>> 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=N and --limit=N options.
>
> BR,
> Jani.
>
>
>>
>> --
>> С уважением,
>> Сергей Шиловский
>> Sergei Shilovsky
>> _______________________________________________
>> notmuch mailing list
>> notmuch at notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch



-- 
С уважением,
Сергей Шиловский
Sergei Shilovsky


More information about the notmuch mailing list