From 355399bde98203af59d20821f9e840fc056bd383 Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Tue, 9 Sep 2014 22:31:49 +0200 Subject: Patch for sidebar iteration functionality sidebar-new will move the selected folder to the next with new messages. If the end is reached, it will start at the top. Useful macros would be: macro index a "" macro pager a "" --- OPS | 1 + curs_main.c | 1 + functions.h | 2 ++ pager.c | 1 + sidebar.c | 10 ++++++++++ 5 files changed, 15 insertions(+) diff --git a/OPS b/OPS index 1ed9c96..3ffb82a 100644 --- a/OPS +++ b/OPS @@ -187,3 +187,4 @@ 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" +OP_SIDEBAR_NEW "iterate though mailboxes with new mail" diff --git a/curs_main.c b/curs_main.c index acb106d..2e35f90 100644 --- a/curs_main.c +++ b/curs_main.c @@ -2328,6 +2328,7 @@ int mutt_index_menu (void) case OP_SIDEBAR_PREV: case OP_SIDEBAR_NEXT_NEW: case OP_SIDEBAR_PREV_NEW: + case OP_SIDEBAR_NEW: scroll_sidebar(op, menu->menu); break; default: diff --git a/functions.h b/functions.h index 363b4d5..1485080 100644 --- a/functions.h +++ b/functions.h @@ -176,6 +176,7 @@ const struct binding_t OpMain[] = { /* map: index */ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, + { "sidebar-new", OP_SIDEBAR_NEW, NULL }, { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, { NULL, 0, NULL } }; @@ -287,6 +288,7 @@ const struct binding_t OpPager[] = { /* map: pager */ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL}, { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL}, + { "sidebar-new", OP_SIDEBAR_NEW, NULL }, { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, { NULL, 0, NULL } }; diff --git a/pager.c b/pager.c index 8d64fe1..696e55c 100644 --- a/pager.c +++ b/pager.c @@ -2791,6 +2791,7 @@ search_next: case OP_SIDEBAR_PREV: case OP_SIDEBAR_NEXT_NEW: case OP_SIDEBAR_PREV_NEW: + case OP_SIDEBAR_NEW: scroll_sidebar(ch, MENU_PAGER); break; diff --git a/sidebar.c b/sidebar.c index c3ea338..eb8ecd2 100644 --- a/sidebar.c +++ b/sidebar.c @@ -429,6 +429,16 @@ void scroll_sidebar(int op, int menu) CurBuffy = CurBuffy->next; } break; + case OP_SIDEBAR_NEW: + if ( (tmp = exist_next_new()) == NULL) + tmp = TopBuffy; + if ( tmp->msg_unread == 0 ) { + CurBuffy = tmp; + tmp = exist_next_new(); + } + if ( tmp != NULL ) + CurBuffy = tmp; + break; default: return; } -- 2.6.0.rc0.2.g7662973.dirty