Hi,
Before I started using mutt, I was using pine and I liked the way I
could just go to the first new message by pressing TAB, no matter what
folder the message was in.
I was wondering if there is any interest in getting this feature into
mutt.
To try it out, I created an initial version of a patch (attached), but
this is mostly to show the kinds of changes to be made and to try it out
and see how it works. It adds a boolean option "next_new_all_folders"
that changes the behaviour of next-new to allow you to jump to the next
new message even if it is in another folder.
There are currently still a few things wrong with the patch:
- it doesn't have the right name
- it doesn't update PATCHES
- it does not properly indent the big switch in curs_main.c (this is
intentional to keep the patch small and easy to read for now)
- it does not work properly in empty folders
- I haven't tested it with previous-new and *-new-then-unread
If this sounds like a useful feature, I'll clean up the patch, fix the
problems and submit it properly.
Regards,
Maurice.
P.S: Would you accept cosmetic patches to replace tabs with spaces?
Tabs and spaces are now used inconsistently.
--
Maurice van der Pot
Gentoo Linux Developer griffon26@xxxxxxxxxx http://www.gentoo.org
Creator of BiteMe! griffon26@xxxxxxxxxxxx http://www.kfk4ever.com
Index: OPS
===================================================================
RCS file: /cvsroots/mutt/OPS,v
retrieving revision 3.7
diff -u -B -r3.7 OPS
--- OPS 24 Jul 2005 16:51:38 -0000 3.7
+++ OPS 28 Jun 2006 18:23:39 -0000
@@ -108,6 +108,7 @@
OP_MAIN_LIMIT "show only messages matching a pattern"
OP_MAIN_LINK_THREADS "link tagged message to the current one"
OP_MAIN_NEXT_NEW "jump to the next new message"
+OP_MAIN_NEXT_NEW_FOLDER "jump to the next new message even if it is in another
folder"
OP_MAIN_NEXT_NEW_THEN_UNREAD "jump to the next new or unread message"
OP_MAIN_NEXT_SUBTHREAD "jump to the next subthread"
OP_MAIN_NEXT_THREAD "jump to the next thread"
Index: curs_main.c
===================================================================
RCS file: /cvsroots/mutt/curs_main.c,v
retrieving revision 3.38
diff -u -B -r3.38 curs_main.c
--- curs_main.c 8 Jun 2006 11:56:05 -0000 3.38
+++ curs_main.c 28 Jun 2006 18:23:40 -0000
@@ -422,6 +422,7 @@
{
char buf[LONG_STRING], helpstr[SHORT_STRING];
int op = OP_NULL;
+ int new_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? */
@@ -608,17 +609,17 @@
}
#endif
- op = km_dokey (MENU_MAIN);
+ new_op = km_dokey (MENU_MAIN);
dprint(4, (debugfile, "mutt_index_menu[%d]: Got op %d\n", __LINE__, op));
- if (op == -1)
+ if (new_op == -1)
continue; /* either user abort or timeout */
mutt_curs_set (1);
/* special handling for the tag-prefix function */
- if (op == OP_TAG_PREFIX)
+ if (new_op == OP_TAG_PREFIX)
{
if (!Context)
{
@@ -638,7 +639,7 @@
clrtoeol ();
/* get the real command */
- if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX)
+ if ((new_op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX)
{
/* abort tag sequence */
CLEARLINE (LINES-1);
@@ -648,7 +649,7 @@
else if (option (OPTAUTOTAG) && Context && Context->tagged)
tag = 1;
- if (op == OP_TAG_PREFIX_COND)
+ if (new_op == OP_TAG_PREFIX_COND)
{
if (!Context)
{
@@ -674,7 +675,7 @@
clrtoeol ();
/* get the real command */
- if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX)
+ if ((new_op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX)
{
/* abort tag sequence */
CLEARLINE (LINES-1);
@@ -694,6 +695,10 @@
mutt_curs_set (1); /* fallback from the pager */
}
+ do
+ {
+ op = new_op;
+ new_op = OP_NULL;
switch (op)
{
@@ -1051,6 +1056,7 @@
menu->redraw = REDRAW_FULL;
break;
+ case OP_MAIN_NEXT_NEW_FOLDER:
case OP_MAIN_CHANGE_FOLDER:
if (attach_msg)
@@ -1068,6 +1074,16 @@
buf[0] = '\0';
mutt_buffy (buf, sizeof (buf));
+ if (op == OP_MAIN_NEXT_NEW_FOLDER)
+ {
+ if (!buf[0])
+ {
+ mutt_error _("No new messages");
+ break;
+ }
+ }
+ else
+ {
if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
{
if (menu->menu == MENU_PAGER)
@@ -1083,6 +1099,7 @@
CLEARLINE (LINES-1);
break;
}
+ }
mutt_expand_path (buf, sizeof (buf));
if (mx_get_magic (buf) <= 0)
@@ -1480,10 +1497,18 @@
if (menu->current == -1)
{
+ if (option (OPTNEXTNEWALLFOLDERS))
+ {
+ menu->current = menu->oldcurrent;
+ new_op = OP_MAIN_NEXT_NEW_FOLDER;
+ }
+ else
+ {
menu->current = menu->oldcurrent;
mutt_error ("%s%s.", (op == OP_MAIN_NEXT_NEW || op ==
OP_MAIN_PREV_NEW) ? _("No new messages") : _("No unread messages"),
Context->pattern ? _(" in this limited view") : "");
}
+ }
else if (menu->menu == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
@@ -2183,6 +2208,7 @@
if (menu->menu == MENU_MAIN)
km_error_key (MENU_MAIN);
}
+ } while(new_op != OP_NULL);
if (menu->menu == MENU_PAGER)
{
Index: init.h
===================================================================
RCS file: /cvsroots/mutt/init.h,v
retrieving revision 3.99
diff -u -B -r3.99 init.h
--- init.h 19 May 2006 18:17:38 -0000 3.99
+++ init.h 28 Jun 2006 18:23:43 -0000
@@ -1297,6 +1297,12 @@
** This variable, when set, makes the thread tree narrower, allowing
** deeper threads to fit on the screen.
*/
+ { "next_new_all_folders", DT_BOOL, R_NONE, OPTNEXTNEWALLFOLDERS, 0 },
+ /*
+ ** .pp
+ ** When set, next-new will go to the next new message even if it is in
+ ** another folder.
+ */
#ifdef USE_SOCKET
{ "net_inc", DT_NUM, R_NONE, UL &NetInc, 10 },
/*
Index: mutt.h
===================================================================
RCS file: /cvsroots/mutt/mutt.h,v
retrieving revision 3.65
diff -u -B -r3.65 mutt.h
--- mutt.h 28 Apr 2006 19:52:45 -0000 3.65
+++ mutt.h 28 Jun 2006 18:23:43 -0000
@@ -399,6 +399,7 @@
OPTMHPURGE,
OPTMIMEFORWDECODE,
OPTNARROWTREE,
+ OPTNEXTNEWALLFOLDERS,
OPTPAGERSTOP,
OPTPIPEDECODE,
OPTPIPESPLIT,
Attachment:
pgptjLxUoHzSu.pgp
Description: PGP signature