On Sun, Aug 02, 2020 at 06:24:24AM -0400, Remco Rijnders wrote:
On Sun, Aug 02, 2020 at 12:24:35PM +0300, Leho wrote in <173ae7cb050.2742.b94389c50b70d4ef8bda8663b7428...@kraav.com>:
Hi. I'm looking for a way to get mutt index to segment list display with Today, Yesterday, Last Week, 2 weeks ago etc separators.

Feels like it should be technically possible, but I haven't been able to find a configuration or a patch for this.

I don't think this is possible "out of the box", as you are limited by
what options $index_format [1] offers, which in turn uses $date_format
[2], which in turn uses the functionality offered by the systems
strftime(3) function. That said, you could use a script as a filter
which provide such functionality [3] by passing it the timestamp of
the message and returning the desired string to display.

I do not know of a script that will do exactly what you want, though
they may exist. If not, you can roll your own, perhaps using some
scripting around the datediff command from the dateutils package [4]?
[snip]
1: http://www.mutt.org/doc/manual/#index-format
2: http://www.mutt.org/doc/manual/#date-format
3: http://www.mutt.org/doc/manual/#formatstrings-filters
4: https://www.fresse.org/dateutils/#datediff

I think this is a great response. Too complicated for me to delve into, and I don't even want or need this functionality -- for me, I'll add it to the pile with "creative" features like "unified inbox" that contemporary mail clients are utilizing that I also have no interest in -- but it looks like it might be at least possible to put Yesterday/Today/etc. type nomenclature in the $index_format variable.

But I don't think Mutt has any concept of the type of separators in the index view that OP is trying to achieve and populate with these type of strings.

Another way of potentially achieving this may be to think outside the box -- or outside the index, in this case.

Why not set up the MTA to deliver mail into a mailbox called "Today" and set up a daily cronjob to do further sorting of the mail into different mailboxes by date? This won't allow for separators in the index view, but will allow OP to view these groups of dates in the mailbox view.

Reply via email to