rvp Try this patch; to use: sort rdate
or set autosort=rdate
:
--- thread.c.orig 2011-04-26 21:23:22.000000000 +0000
+++ thread.c 2021-06-28 23:18:37.239641723 +0000
@@ -283,6 +283,18 @@
}
static int
+mlonggt(const void *a, const void *b)
+{
+ int i;
+
+ i = ((struct msort *)a)->ms_u.ms_long -
+ ((struct msort *)b)->ms_u.ms_long;
+ if (i == 0)
+ i = ((struct msort *)a)->ms_n - ((struct msort *)b)->ms_n;
+ return i < 0 ? 1 : i > 0 ? -1 : 0;
+}
+
+static int
mlonglt(const void *a, const void *b)
{
int i;
@@ -498,6 +510,7 @@
enum method {
SORT_SUBJECT,
SORT_DATE,
+ SORT_RDATE,
SORT_STATUS,
SORT_SIZE,
SORT_FROM,
@@ -511,6 +524,7 @@
int (*me_func)(const void *, const void *);
} methnames[] = {
{ "date", SORT_DATE, mlonglt },
+ { "rdate", SORT_RDATE, mlonggt },
{ "from", SORT_FROM, mcharlt },
{ "to", SORT_TO, mcharlt },
{ "subject", SORT_SUBJECT, mcharlt },
@@ -556,6 +570,7 @@
switch (method) {
case SORT_SUBJECT:
case SORT_DATE:
+ case SORT_RDATE:
case SORT_FROM:
case SORT_TO:
if (mb.mb_type == MB_IMAP)
@@ -569,6 +584,7 @@
if ((mp->m_flag&MHIDDEN) == 0) {
switch (method) {
case SORT_DATE:
+ case SORT_RDATE:
if (mp->m_date == 0 &&
(cp = hfield("date", mp)) != 0)
mp->m_date = rfctime(cp);
@@ -638,6 +654,8 @@
finalize(threadroot);
mb.mb_threaded = 2;
ac_free(ms);
+ if (method == SORT_RDATE)
+ msgvec[0] = n;
return vp && vp != (void *)-1 && !inhook &&
value("header") ? headers(msgvec) : 0;
}