You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From ed547aeb2c6f10da3639e5212b47f4e3aea450d6 Mon Sep 17 00:00:00 2001
  2. From: Julius Haertl <jus@bitgrid.net>
  3. Date: Tue, 9 Sep 2014 22:31:49 +0200
  4. Subject: [PATCH] Patch for sidebar iteration functionality
  5. sidebar-new will move the selected folder to the next with new messages.
  6. If the end is reached, it will start at the top.
  7. Useful macros would be:
  8. macro index <esc>a "<sidebar-new><sidebar-open>"
  9. macro pager <esc>a "<exit><sidebar-new><sidebar-open>"
  10. ---
  11. OPS | 1 +
  12. curs_main.c | 1 +
  13. functions.h | 2 ++
  14. pager.c | 1 +
  15. sidebar.c | 10 ++++++++++
  16. 5 files changed, 15 insertions(+)
  17. diff --git a/OPS b/OPS
  18. index b900373..62db4b4 100644
  19. --- a/OPS
  20. +++ b/OPS
  21. @@ -206,3 +206,4 @@ OP_SIDEBAR_PREV "go to previous mailbox"
  22. OP_SIDEBAR_OPEN "open hilighted mailbox"
  23. OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail"
  24. OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail"
  25. +OP_SIDEBAR_NEW "iterate though mailboxes with new mail"
  26. diff --git a/curs_main.c b/curs_main.c
  27. index 8cec507..fb0a74f 100644
  28. --- a/curs_main.c
  29. +++ b/curs_main.c
  30. @@ -2550,6 +2550,7 @@ int mutt_index_menu (void)
  31. case OP_SIDEBAR_PREV:
  32. case OP_SIDEBAR_NEXT_NEW:
  33. case OP_SIDEBAR_PREV_NEW:
  34. + case OP_SIDEBAR_NEW:
  35. scroll_sidebar(op, menu->menu);
  36. break;
  37. default:
  38. diff --git a/functions.h b/functions.h
  39. index 66f3345..8ca5411 100644
  40. --- a/functions.h
  41. +++ b/functions.h
  42. @@ -195,6 +195,7 @@ const struct binding_t OpMain[] = { /* map: index */
  43. { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
  44. { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL},
  45. { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL},
  46. + { "sidebar-new", OP_SIDEBAR_NEW, NULL },
  47. { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
  48. { NULL, 0, NULL }
  49. };
  50. @@ -317,6 +318,7 @@ const struct binding_t OpPager[] = { /* map: pager */
  51. { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
  52. { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL},
  53. { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL},
  54. + { "sidebar-new", OP_SIDEBAR_NEW, NULL },
  55. { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
  56. { NULL, 0, NULL }
  57. };
  58. diff --git a/pager.c b/pager.c
  59. index e888452..9a7d076 100644
  60. --- a/pager.c
  61. +++ b/pager.c
  62. @@ -2868,6 +2868,7 @@ search_next:
  63. case OP_SIDEBAR_PREV:
  64. case OP_SIDEBAR_NEXT_NEW:
  65. case OP_SIDEBAR_PREV_NEW:
  66. + case OP_SIDEBAR_NEW:
  67. scroll_sidebar(ch, MENU_PAGER);
  68. break;
  69. diff --git a/sidebar.c b/sidebar.c
  70. index c3ea338..eb8ecd2 100644
  71. --- a/sidebar.c
  72. +++ b/sidebar.c
  73. @@ -429,6 +429,16 @@ void scroll_sidebar(int op, int menu)
  74. CurBuffy = CurBuffy->next;
  75. }
  76. break;
  77. + case OP_SIDEBAR_NEW:
  78. + if ( (tmp = exist_next_new()) == NULL)
  79. + tmp = TopBuffy;
  80. + if ( tmp->msg_unread == 0 ) {
  81. + CurBuffy = tmp;
  82. + tmp = exist_next_new();
  83. + }
  84. + if ( tmp != NULL )
  85. + CurBuffy = tmp;
  86. + break;
  87. default:
  88. return;
  89. }
  90. --
  91. 2.1.0