--- a/buffy.c.orig 2015-12-15 19:11:10.949983000 +0100 +++ b/buffy.c 2015-12-15 19:11:10.963818000 +0100 @@ -26,6 +26,7 @@ #include "mx.h" #include "mutt_curses.h" +#include "sidebar.h" #ifdef USE_IMAP #include "imap.h" @@ -602,19 +603,28 @@ { case M_MBOX: case M_MMDF: - buffy_mbox_update (tmp, &sb); + if (sidebar_should_refresh()) { + buffy_mbox_update (tmp, &sb); + sidebar_updated(); + } if (buffy_mbox_hasnew (tmp, &sb) > 0) BuffyCount++; break; case M_MAILDIR: - buffy_maildir_update (tmp); + if (sidebar_should_refresh()) { + buffy_maildir_update (tmp); + sidebar_updated(); + } if (buffy_maildir_hasnew (tmp) > 0) BuffyCount++; break; case M_MH: - mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked); + if (sidebar_should_refresh()) { + mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked); + sidebar_updated(); + } mh_buffy(tmp); if (tmp->new) BuffyCount++; Index: mutt/globals.h =================================================================== --- a/globals.h.orig 2015-12-15 19:11:10.951646000 +0100 +++ b/globals.h 2015-12-15 19:11:10.963953000 +0100 @@ -219,6 +219,8 @@ WHERE struct buffy_t *CurBuffy INITVAL(0); WHERE short DrawFullLine INITVAL(0); WHERE short SidebarWidth; +WHERE short SidebarRefresh; +WHERE short SidebarLastRefresh; #ifdef USE_IMAP WHERE short ImapKeepalive; WHERE short ImapPipelineDepth; Index: mutt/init.h =================================================================== --- a/init.h.orig 2015-12-15 19:11:10.954277000 +0100 +++ b/init.h 2015-12-15 19:11:10.966235000 +0100 @@ -2042,6 +2042,12 @@ ** .pp ** The width of the sidebar. */ + { "sidebar_refresh", DT_NUM, R_BOTH, UL &SidebarRefresh, 60 }, + /* + ** .pp + ** Do not refresh sidebar in less than $sidebar_refresh seconds, + ** (0 disables refreshing). + */ { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 }, /* ** .pp Index: mutt/sidebar.c =================================================================== --- a/sidebar.c.orig 2015-12-15 19:11:10.959133000 +0100 +++ b/sidebar.c 2015-12-15 19:11:10.966747000 +0100 @@ -211,6 +211,7 @@ saveSidebarWidth = SidebarWidth; if(!option(OPTSIDEBAR)) SidebarWidth = 0; initialized = true; + SidebarLastRefresh = time(NULL); } /* save or restore the value SidebarWidth */ @@ -417,3 +418,16 @@ draw_sidebar(menu); } +int sidebar_should_refresh() +{ + if (option(OPTSIDEBAR) && SidebarRefresh > 0) { + if (time(NULL) - SidebarLastRefresh >= SidebarRefresh) + return 1; + } + return 0; +} +void sidebar_updated() +{ + SidebarLastRefresh = time(NULL); +} + Index: mutt/sidebar.h =================================================================== --- a/sidebar.h.orig 2015-12-15 19:11:10.959229000 +0100 +++ b/sidebar.h 2015-12-15 19:11:10.966962000 +0100 @@ -32,5 +32,7 @@ void scroll_sidebar(int, int); void set_curbuffy(char*); void set_buffystats(CONTEXT*); +int sidebar_should_refresh(); +void sidebar_updated(); #endif /* SIDEBAR_H */