Index: mutt-1.5.19/OPS =================================================================== --- mutt-1.5.19.orig/OPS 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/OPS 2009-06-08 16:52:06.000000000 +0000 @@ -184,3 +184,5 @@ OP_SIDEBAR_NEXT "go down to next mailbox" OP_SIDEBAR_PREV "go to previous mailbox" OP_SIDEBAR_OPEN "open hilighted mailbox" +OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail" +OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail" Index: mutt-1.5.19/curs_main.c =================================================================== --- mutt-1.5.19.orig/curs_main.c 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/curs_main.c 2009-06-08 16:51:12.000000000 +0000 @@ -2229,6 +2229,8 @@ case OP_SIDEBAR_SCROLL_DOWN: case OP_SIDEBAR_NEXT: case OP_SIDEBAR_PREV: + case OP_SIDEBAR_NEXT_NEW: + case OP_SIDEBAR_PREV_NEW: scroll_sidebar(op, menu->menu); break; default: Index: mutt-1.5.19/functions.h =================================================================== --- mutt-1.5.19.orig/functions.h 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/functions.h 2009-06-08 16:51:12.000000000 +0000 @@ -173,6 +173,10 @@ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, + { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, + { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, + { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, + { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, { NULL, 0, NULL } }; Index: mutt-1.5.19/init.h =================================================================== --- mutt-1.5.19.orig/init.h 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/init.h 2009-06-08 16:51:12.000000000 +0000 @@ -1600,6 +1600,11 @@ {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"}, /* ** .pp + ** Show only new mail in the sidebar. + */ + {"sidebar_newmail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, "no" }, + /* + ** .pp ** This specifies the delimiter between the sidebar (if visible) and ** other screens. */ Index: mutt-1.5.19/mutt.h =================================================================== --- mutt-1.5.19.orig/mutt.h 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/mutt.h 2009-06-08 16:51:12.000000000 +0000 @@ -508,6 +508,8 @@ OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */ OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */ + OPTSIDEBARNEWMAILONLY, + OPTMAX }; Index: mutt-1.5.19/pager.c =================================================================== --- mutt-1.5.19.orig/pager.c 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/pager.c 2009-06-08 16:51:12.000000000 +0000 @@ -2698,6 +2698,8 @@ case OP_SIDEBAR_SCROLL_DOWN: case OP_SIDEBAR_NEXT: case OP_SIDEBAR_PREV: + case OP_SIDEBAR_NEXT_NEW: + case OP_SIDEBAR_PREV_NEW: scroll_sidebar(ch, MENU_PAGER); break; Index: mutt-1.5.19/sidebar.c =================================================================== --- mutt-1.5.19.orig/sidebar.c 2009-06-08 16:51:12.000000000 +0000 +++ mutt-1.5.19/sidebar.c 2009-06-08 16:51:12.000000000 +0000 @@ -232,8 +232,20 @@ SETCOLOR(MT_COLOR_NEW); else if ( tmp->msg_flagged > 0 ) SETCOLOR(MT_COLOR_FLAGGED); - else + else { + /* make sure the path is either: + 1. Containing new mail. + 2. The inbox. + 3. The current box. + */ + if ((option (OPTSIDEBARNEWMAILONLY)) && + ( (tmp->msg_unread <= 0) && + ( tmp != Incoming ) && + ( strcmp( tmp->path, Context->path ) != 0 ) ) ) + continue; + else SETCOLOR(MT_COLOR_NORMAL); + } move( lines, 0 ); if ( Context && !strcmp( tmp->path, Context->path ) ) { @@ -296,20 +308,62 @@ } } +BUFFY * exist_next_new() +{ + BUFFY *tmp = CurBuffy; + if(tmp == NULL) return NULL; + while (tmp->next != NULL) + { + tmp = tmp->next; + if(tmp->msg_unread) return tmp; + } + return NULL; +} + +BUFFY * exist_prev_new() +{ + BUFFY *tmp = CurBuffy; + if(tmp == NULL) return NULL; + while (tmp->prev != NULL) + { + tmp = tmp->prev; + if(tmp->msg_unread) return tmp; + } + return NULL; +} + + void scroll_sidebar(int op, int menu) { + BUFFY *tmp; if(!SidebarWidth) return; if(!CurBuffy) return; switch (op) { case OP_SIDEBAR_NEXT: + if (!option (OPTSIDEBARNEWMAILONLY)) { if ( CurBuffy->next == NULL ) return; CurBuffy = CurBuffy->next; break; + } + case OP_SIDEBAR_NEXT_NEW: + if ( (tmp = exist_next_new()) == NULL) + return; + else CurBuffy = tmp; + break; + case OP_SIDEBAR_PREV: + if (!option (OPTSIDEBARNEWMAILONLY)) { + if ( CurBuffy->prev == NULL ) return; CurBuffy = CurBuffy->prev; break; + } + case OP_SIDEBAR_PREV_NEW: + if ( (tmp = exist_prev_new()) == NULL) + return; + else CurBuffy = tmp; + break; case OP_SIDEBAR_SCROLL_UP: CurBuffy = TopBuffy; if ( CurBuffy != Incoming ) {