On Wednesday, David T-G said something like:
> ...and then Brett Coon said...
> % I'd like to map the <Tab> key to go to the next new message if
> % there is one, else the next unread message. How can I do that?
>
> That's a great idea, but I think that the current answer is that it can't
> be done.
Since this particular case is pretty trivial and definitely
something I want, I went ahead and modified the source to
implement it. Now "next-new" turns into "next-unread" if there
are no new messages. The "previous-" functions behave similarly.
Ideally, there would be a variable to enable or disable this
functionality, or else a new function added like "next-new-or-
unread", since there may well be some people who don't want this
behavior. But that's beyond my current understanding of the mutt
sources right now...
-Brett
Here's the patch (to version 1.2.4) for any others who are
interested:
*** mutt-1.2.4.orig/curs_main.c Sat Apr 22 01:25:20 2000
--- mutt-1.2.4/curs_main.c Wed Aug 2 12:44:37 2000
***************
*** 385,391 ****
char buf[LONG_STRING], helpstr[SHORT_STRING];
int op = OP_NULL;
int done = 0; /* controls when to exit the "event" loop */
! int i = 0, j;
int tag = 0; /* has the tag-prefix command been pressed? */
int newcount = -1;
int oldcount = -1;
--- 385,391 ----
char buf[LONG_STRING], helpstr[SHORT_STRING];
int op = OP_NULL;
int done = 0; /* controls when to exit the "event" loop */
! int i = 0, j, k;
int tag = 0; /* has the tag-prefix command been pressed? */
int newcount = -1;
int oldcount = -1;
***************
*** 1193,1198 ****
--- 1193,1199 ----
CHECK_MSGCOUNT;
i = menu->current;
menu->current = -1;
+ k = -1;
for (j = 0; j != Context->vcount; j++)
{
#define CUR Context->hdrs[Context->v2r[i]]
***************
*** 1217,1222 ****
--- 1218,1227 ----
if (CUR->collapsed && (Sort & SORT_MASK) == SORT_THREADS)
{
+ /* Remember the first unread message we find */
+ if ( k == -1 && UNREAD (CUR) ) {
+ k = i;
+ }
if ((op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD) &&
UNREAD (CUR))
{
***************
*** 1232,1237 ****
--- 1237,1246 ----
}
else if ((!CUR->deleted && !CUR->read))
{
+ /* Remember the first unread message we find */
+ if ( k == -1 ) {
+ k = i;
+ }
if (op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD || !CUR->old)
{
menu->current = i;
***************
*** 1239,1244 ****
--- 1248,1259 ----
}
}
}
+ /* If we're looking for something new but found nothing, use */
+ /* the first unread message we found, if there is one */
+ if (menu->current == -1) {
+ menu->current = k;
+ }
+
#undef CUR
if (menu->current == -1)
{
--
----- Brett Coon - [EMAIL PROTECTED] - http://www.rahul.net/brett -------
Mr. Wint: The scorpion.
Mr. Kidd: One of nature's finest killers, Mr. Wint.
Mr. Wint: One is never too old to learn from a master, Mr. Kidd.
[144] "Diamonds Are Forever" (1971)