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

Re: change_folder_next patch



On Saturday, 14 April 2007 at 14:02, N.J. Mann wrote:
> Hi Brendan,
> 
> On Friday, 13 April, 2007 at 15:51:21 +0100, N.J. Mann wrote:
> > On Friday, 13 April, 2007 at 12:24:14 +0100, N.J. Mann wrote:
> > > On Thursday, 29 March, 2007 at 16:03:15 -0700, Brendan Cully wrote:
> > > > I'm not sure whether it's worth it, but I think if we want this, it
> > > > might be nicer as a second command than a configuration
> > > > variable. Perhaps <next-folder> ? It wouldn't even need to prompt.
> > > 
> > > As there hadn't been any followup on the list for this I had a go
> > > myself.  This is the first time I have hacked on Mutt, so I have
> > > probably missed something.  My patch (below) is based on mutt 1.15.5
> > > (FreeBSD).  Does this look okay?
> > 
> > I had a rethink about this over lunch and I have now changed my patch to
> > work exactly as you suggested.  It isn't quite right yet so I'll hold
> > back on publishing it, I just wanted to let you know that a new patch is
> > in the works.  Comments about the original one would be welcome.
> 
> Okay, here is the latest version of my patch.

> --- 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"
>  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"

> --- curs_main.c~      Fri Apr 13 15:17:02 2007
> +++ curs_main.c       Fri Apr 13 15:59:56 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,18 +1067,27 @@
>            cp = _("Open mailbox");
>  
>       buf[0] = '\0';
> -     mutt_buffy (buf, sizeof (buf));
> +     if ((op == OP_MAIN_NEXT_FOLDER) && Context && Context->path)
> +     {
> +       strfcpy (buf, Context->path, sizeof (buf));
> +       mutt_pretty_mailbox (buf);
> +       mutt_buffy (buf, sizeof (buf));
> +     }
> +     else
> +     {
> +       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 (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);

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...

given that, it might be better not to bind the action by default. ","
seems pretty easy to hit...

Attachment: pgp5uRvHqMoyA.pgp
Description: PGP signature