unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Backward scrolling notmuch_messages_t and notmuch_threads_t
@ 2014-10-07 11:00 Sergei Shilovsky
  2014-10-07 11:16 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shilovsky @ 2014-10-07 11:00 UTC (permalink / raw)
  To: notmuch

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?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Backward scrolling notmuch_messages_t and notmuch_threads_t
  2014-10-07 11:00 Backward scrolling notmuch_messages_t and notmuch_threads_t Sergei Shilovsky
@ 2014-10-07 11:16 ` Jani Nikula
  2014-10-07 14:04   ` Sergei Shilovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2014-10-07 11:16 UTC (permalink / raw)
  To: sshilovsky, notmuch

On Tue, 07 Oct 2014, Sergei Shilovsky <sshilovsky@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Backward scrolling notmuch_messages_t and notmuch_threads_t
  2014-10-07 11:16 ` Jani Nikula
@ 2014-10-07 14:04   ` Sergei Shilovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Shilovsky @ 2014-10-07 14:04 UTC (permalink / raw)
  To: Jani Nikula; +Cc: notmuch

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@nikula.org> wrote:
> On Tue, 07 Oct 2014, Sergei Shilovsky <sshilovsky@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@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-07 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 11:00 Backward scrolling notmuch_messages_t and notmuch_threads_t Sergei Shilovsky
2014-10-07 11:16 ` Jani Nikula
2014-10-07 14:04   ` Sergei Shilovsky

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).