Sorting threads in NeoMutt
In NeoMutt, which I use for email, I wanted view email conversations (a “thread”) as a tree-like representation. This option can be enabled by sorting on threads. However, by default threads are sorted by their oldest message, which is the original email to which others started responding. This causes the unwanted behavior that new emails that belong to a thread to not show on top of my inbox, but instead are hidden somewhere deeper in my inbox, sorted at the date of the older original post. I did not quickly find people with similar wishes (and solution) on the internet, so I considered it potentially helpful to write down my solution here.
To solve this behavior, I defined a secondary sorting method.
The primary sorting method is on threads, but I want threads themselves to be sorted based on the date of the newest message.
Also, I still want to ensure that newest messages show up on top, and not on the bottom (this is the reverse of the default setting in NeoMutt).
I achieved this by setting these variables in my neomuttrc
:
set sort = threads
set sort_aux = reverse-last-date-received
This produces a tree-like representation as such:

Note that this is a very messy thread, where nobody cared to change the email title, and where multiple threads branch off from each other. Nevertheless, using NeoMutt with the thread sorting, I know exactly who responded to who.
Comments
profnof on Saturday, Nov 14, 2020:
Reply to profnof
Edwin on Saturday, Nov 14, 2020
In reply to profnof
Le Chen on Friday, Mar 26, 2021:
Reply to Le Chen
Edwin on Friday, Mar 26, 2021
In reply to Le Chen
mariansam on Tuesday, Apr 20, 2021:
Wow, big thanks for this I had
set sort = 'reverse-date'
and I didn’t know about it. This solved my issue.However, I’d love to see even my responses in the thread! Is that possible? Currently the received messages are in the INBOX mailbox and the sent messages are in the Sent mailbox. Is that something I have to change on the server side, or can neomutt deal with that?
contact: mariansam edwinwenink.xyz@mariansam.eu
Reply to mariansam
Edwin on Wednesday, Apr 21, 2021
In reply to mariansam