~rjarry/aerc-discuss

9 3

Loading newest email first

Details
Message ID
<CV443VX1CF2K.1T7A8Q1SZTY6L@fusion>
DKIM signature
missing
Download raw message
Hello!

First of all, a big thank you to all contributors and maintainers, aerc
is my daily driver email client :D

Now, I prefer sorting my email list simply by newest first (sort="-r
date"). However, aerc seems to always fetch the page from oldest to
newest, which turns out to be a bit inconvenient when using slow
Internet, since it can take a hot minute to load the top messages which
are of most interest to me. 
(I know I should organize my inbox email better to avoid having full
pages hehe 😅)

Is it possible to load mail in this order (perhaps a configurable or
derived from `sort`), or is there a limitation from the protocol (IMAP
in this case)?

Once again, thank you,

~tmpod
Details
Message ID
<CV44NT2BYWW2.PW589HEQIOSC@ringo>
In-Reply-To
<CV443VX1CF2K.1T7A8Q1SZTY6L@fusion> (view parent)
DKIM signature
missing
Download raw message
Hi,

tmpod, Aug 28, 2023 at 12:48:
> Is it possible to load mail in this order (perhaps a configurable or
> derived from `sort`), or is there a limitation from the protocol (IMAP
> in this case)?

did you try to comment/remove the sort configuration option from
aerc.conf?

I know that some IMAP servers don't support sorting by date and return
messages in a random order when asked to do so. I use Gmail's IMAP for
work and without sort= set to anything, the most recent messages appear
on top.

Robin
Details
Message ID
<CV4742D28S8W.3E2S4MS9JOXF5@fusion>
In-Reply-To
<CV44NT2BYWW2.PW589HEQIOSC@ringo> (view parent)
DKIM signature
missing
Download raw message
I just tried commenting that config and it surprisingly made no
difference. The message list filled from bottom to top, with the newest
mail at the top.
So does the protocol not support specifying a sort and we just get what
each implementation decides to go with?
Details
Message ID
<CV47ISQCUDKR.3L3HI4FX5NJGJ@spunky>
In-Reply-To
<CV443VX1CF2K.1T7A8Q1SZTY6L@fusion> (view parent)
DKIM signature
missing
Download raw message
On Mon Aug 28, 2023 at 5:48 AM CDT, tmpod wrote:
> Hello!
>
> First of all, a big thank you to all contributors and maintainers, aerc
> is my daily driver email client :D
>
> Now, I prefer sorting my email list simply by newest first (sort="-r
> date"). However, aerc seems to always fetch the page from oldest to
> newest, which turns out to be a bit inconvenient when using slow
> Internet, since it can take a hot minute to load the top messages which
> are of most interest to me. 
> (I know I should organize my inbox email better to avoid having full
> pages hehe 😅)
>
> Is it possible to load mail in this order (perhaps a configurable or
> derived from `sort`), or is there a limitation from the protocol (IMAP
> in this case)?

Hello!

It is technically possible, but would really hurt performance. The way this all
works is like so:

1. We search IMAP for all messages in the folder. IMAP responds with a list in
   ascending date order. We reverse the list so that the list is in descending
   order. Let's say the UIDs for this list are 1:5000, with 5000 being the
   newest message. If the server supports SORT, we get the list in the order we
   want and we don't have to reverse it in the '-r' case
2. We download the headers for the visible messages, let's say this is
   4950:5000. IMAP will respond with the headers in 4950:5000 order. Because of
   we receive 4950 before 5000. Even for IMAP servers that support SORT, they
   will return headers like this (FETCH commands are unaffected by SORT)

The fix would be to request 5000, then 4999, then 4998...and so on. This adds a
lot of extra round trips and would significantly slow down the 

-- 
Tim
Details
Message ID
<CV47OJE2PMEG.1IMLPEQXL2GNV@ringo>
In-Reply-To
<CV4742D28S8W.3E2S4MS9JOXF5@fusion> (view parent)
DKIM signature
missing
Download raw message
tmpod, Aug 28, 2023 at 15:01:
> I just tried commenting that config and it surprisingly made no
> difference. The message list filled from bottom to top, with the newest
> mail at the top.

I'm confused, isn't this exactly what you wanted to do with your config?
Details
Message ID
<CV48NCHQT76G.2EUP978DZMNIW@fusion>
In-Reply-To
<CV47OJE2PMEG.1IMLPEQXL2GNV@ringo> (view parent)
DKIM signature
missing
Download raw message
No, I'd like to get the "-r date" sorting, but fetch/receive the newest
messages first. At the moment, the list is properly sorted, but messages
start coming in from oldest to newest (in that page).
Details
Message ID
<CV48RL5RLH9P.V2N019YGORM1@fusion>
In-Reply-To
<CV47ISQCUDKR.3L3HI4FX5NJGJ@spunky> (view parent)
DKIM signature
missing
Download raw message
Thank you a lot for your detailed response!

> 1. We search IMAP for all messages in the folder. IMAP responds with a list in
>    ascending date order. We reverse the list so that the list is in descending
>    order. Let's say the UIDs for this list are 1:5000, with 5000 being the
>    newest message. If the server supports SORT, we get the list in the order we
>    want and we don't have to reverse it in the '-r' case
> 2. We download the headers for the visible messages, let's say this is
>    4950:5000. IMAP will respond with the headers in 4950:5000 order. Because of
>    we receive 4950 before 5000. Even for IMAP servers that support SORT, they
>    will return headers like this (FETCH commands are unaffected by SORT)

I see now, IMAP doesn't support sorting in those header windows, quite
unfortunate :(

> The fix would be to request 5000, then 4999, then 4998...and so on. This adds a
> lot of extra round trips and would significantly slow down the 

Yeah, that would be undesirable.

Welp ¯\_(ツ)_/¯
I'll just keep doing what I was doing 

Thank you!

~tmpod
Details
Message ID
<CV48Y0UWC8KW.SE13FXGZ6D1N@spunky>
In-Reply-To
<CV48RL5RLH9P.V2N019YGORM1@fusion> (view parent)
DKIM signature
missing
Download raw message
On Mon Aug 28, 2023 at 9:24 AM CDT, tmpod wrote:
> Thank you a lot for your detailed response!
>
> > 1. We search IMAP for all messages in the folder. IMAP responds with a list in
> >    ascending date order. We reverse the list so that the list is in descending
> >    order. Let's say the UIDs for this list are 1:5000, with 5000 being the
> >    newest message. If the server supports SORT, we get the list in the order we
> >    want and we don't have to reverse it in the '-r' case
> > 2. We download the headers for the visible messages, let's say this is
> >    4950:5000. IMAP will respond with the headers in 4950:5000 order. Because of
> >    we receive 4950 before 5000. Even for IMAP servers that support SORT, they
> >    will return headers like this (FETCH commands are unaffected by SORT)
>
> I see now, IMAP doesn't support sorting in those header windows, quite
> unfortunate :(
>
> > The fix would be to request 5000, then 4999, then 4998...and so on. This adds a
> > lot of extra round trips and would significantly slow down the 
>
> Yeah, that would be undesirable.
>
> Welp ¯\_(ツ)_/¯
> I'll just keep doing what I was doing 
>
> Thank you!
>
> ~tmpod

Do you have header caching on? This should help significantly on slow
connections. Another optimization is to set the 'headers' config key in an
account to "references". This will force aerc to only fetch a small subset of
headers (basically those required to thread + display messages).


-- 
Tim
Details
Message ID
<CV4B884ILSZY.MVGQXVTSYYH4@fusion>
In-Reply-To
<CV48Y0UWC8KW.SE13FXGZ6D1N@spunky> (view parent)
DKIM signature
missing
Download raw message
No, how do I enable those?
I looked at the default config files[1] and couldn't find those keys.

~tmpod

[1]: https://git.sr.ht/~rjarry/aerc/tree/master/item/config
Details
Message ID
<CV4CK67X3TQA.3TW6DJY2IQR3D@spunky>
In-Reply-To
<CV4B884ILSZY.MVGQXVTSYYH4@fusion> (view parent)
DKIM signature
missing
Download raw message
On Mon Aug 28, 2023 at 11:14 AM CDT, tmpod wrote:
> No, how do I enable those?
> I looked at the default config files[1] and couldn't find those keys.

'headers' is in the accounts config (man aerc-accounts). I recommend setting it
to headers=references. This will give you everything you need for threading and
nothing more.

cache-headers is in the IMAP man page (also will end up in your account config),
see man aerc-imap.

Your account config could then be like this:

    [imap]
    source = ....
    source-cred-cmd = ....
    headers = references
    cache-headers = true

-- 
Tim
Reply to thread Export thread (mbox)