<<< Date Index >>>     <<< Thread Index >>>

Re: change_folder_next patch



On Monday, 30 April, 2007 at 07:15:56 +0100, N.J. Mann wrote:
> On Sunday, 29 April, 2007 at 18:45:48 -0700, Brendan Cully wrote:
> > On Saturday, 14 April 2007 at 14:02, N.J. Mann wrote:
[...]
> > > +++ OPS   Thu Apr 12 21:07:23 2007
> > > @@ -107,6 +107,7 @@
> > >  OP_MAIN_LAST_MESSAGE "move to the last message"
> > >  OP_MAIN_LIMIT "show only messages matching a pattern"
> > >  OP_MAIN_LINK_THREADS "link tagged message to the current one"
> > > +OP_MAIN_NEXT_FOLDER "open next folder"
> > >  OP_MAIN_NEXT_NEW "jump to the next new message"
> > >  OP_MAIN_NEXT_NEW_THEN_UNREAD "jump to the next new or unread message"
> > >  OP_MAIN_NEXT_SUBTHREAD "jump to the next subthread"
> > 
> > should probably read "open next folder with new mail"
> 
> I did wonder about that.  You suggestion does make more sense.

Done that.

[...]
> > I haven't tested it, but it looks like it still prompts you for the
> > folder name. I think it'd be nicer if it simply jumped to the next
> > folder if there was one with new mail, or beeped if not...
> 
> I does not prompt you, it just jumps to the next folder with new mail.
> Otherwise it does nothing.  (The whitespace changes for the extra
> indentation make the patch larger than it really is. :-)  The call to
> mutt_enter_fname is now inside the else of the if OP_MAIN_NEXT_FOLDER.)
> 
> I suppose it could beep since mutt does beep in similar circumstances.
> I could look into that if you really think it is a requirement for
> adoption.  I may do this anyway if I get time later on today.

Okay done that see attached patch.  ;-)

> > given that, it might be better not to bind the action by default. ","
> > seems pretty easy to hit...
> 
> It was the only key I could find that was not bound by default.  I
> have not hit it by mistake in just over two weeks use, but I can
> understand your worry.  If you think it best to have it unbound by
> default that is okay with me.

I've left it bound to ',' for now, but...

Again, all comments gratefully received.


Cheers,
       Nick.
-- 
Please do not CC me on replies, I read the list and don't need the dupes.

--- functions.h~        Sun Apr  1 22:58:55 2007
+++ functions.h Thu Apr 12 20:52:01 2007
@@ -88,6 +88,7 @@
   { "break-thread",            OP_MAIN_BREAK_THREAD,           "#" },
   { "change-folder",           OP_MAIN_CHANGE_FOLDER,          "c" },
   { "change-folder-readonly",  OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
+  { "next-folder",             OP_MAIN_NEXT_FOLDER,            "," },
   { "collapse-thread",         OP_MAIN_COLLAPSE_THREAD,        "\033v" },
   { "collapse-all",            OP_MAIN_COLLAPSE_ALL,           "\033V" },
   { "copy-message",            OP_COPY_MESSAGE,                "C" },
@@ -176,6 +177,7 @@
   { "bounce-message",  OP_BOUNCE_MESSAGE,              "b" },
   { "change-folder",   OP_MAIN_CHANGE_FOLDER,          "c" },
   { "change-folder-readonly",  OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
+  { "next-folder",     OP_MAIN_NEXT_FOLDER,            "," },
   { "copy-message",    OP_COPY_MESSAGE,                "C" },
   { "decode-copy",     OP_DECODE_COPY,                 "\033C" },
   { "delete-message",  OP_DELETE,                      "d" },
--- OPS~        Sun Apr  1 22:58:55 2007
+++ OPS Thu Apr 12 21:07:23 2007
@@ -107,6 +107,7 @@
 OP_MAIN_LAST_MESSAGE "move to the last message"
 OP_MAIN_LIMIT "show only messages matching a pattern"
 OP_MAIN_LINK_THREADS "link tagged message to the current one"
+OP_MAIN_NEXT_FOLDER "open next folder with new mail"
 OP_MAIN_NEXT_NEW "jump to the next new message"
 OP_MAIN_NEXT_NEW_THEN_UNREAD "jump to the next new or unread message"
 OP_MAIN_NEXT_SUBTHREAD "jump to the next subthread"
--- curs_main.c~        Mon Apr 30 07:49:14 2007
+++ curs_main.c Mon Apr 30 08:33:15 2007
@@ -1052,6 +1052,7 @@
        break;
 
       case OP_MAIN_CHANGE_FOLDER:
+      case OP_MAIN_NEXT_FOLDER:
       
        if (attach_msg)
          op = OP_MAIN_CHANGE_FOLDER_READONLY;
@@ -1066,22 +1067,36 @@
           cp = _("Open mailbox");
 
        buf[0] = '\0';
-       mutt_buffy (buf, sizeof (buf));
-
-       if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
-        {
-          if (menu->menu == MENU_PAGER)
-          {
-            op = OP_DISPLAY_MESSAGE;
-            continue;
-          }
-          else
-            break;
-        }
-       if (!buf[0])
+       if ((op == OP_MAIN_NEXT_FOLDER) && Context && Context->path)
+       {
+         strfcpy (buf, Context->path, sizeof (buf));
+         mutt_pretty_mailbox (buf);
+         mutt_buffy (buf, sizeof (buf));
+         if (!buf[0])
+         {
+           mutt_error _("No new messages");
+           break;
+         }
+       }
+       else
        {
-         CLEARLINE (LINES-1);
-         break;
+         mutt_buffy (buf, sizeof (buf));
+
+         if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
+         {
+           if (menu->menu == MENU_PAGER)
+           {
+             op = OP_DISPLAY_MESSAGE;
+             continue;
+           }
+           else
+             break;
+         }
+         if (!buf[0])
+         {
+           CLEARLINE (LINES-1);
+           break;
+         }
        }
 
        mutt_expand_path (buf, sizeof (buf));