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

Re: change_folder_next patch



Hi Brendan,


On Thursday, 29 March, 2007 at 16:03:15 -0700, Brendan Cully wrote:
> On Monday, 05 March 2007 at 13:43, Antoine Reilles wrote:
> > Hi,
> > 
> > A patch to add a (change_folder_next) option to mutt was proposed long
> > time ago. It allow the change-folder command to start at the folder
> > after the current folder. The reason is that it may be annoying 
> > that the 'c' (change-folder) command always starts from the first
> > folder in the mailboxes list.
> > 
> > The patch was proposed by Simon Burge in
> > http://permalink.gmane.org/gmane.mail.mutt.devel/714
> > 
> > Since then, it is integrated as a pkgsrc patch (http://www.pkgsrc.org/)
> > but i would really prefer to see it in mutt. Also, i think it may be of
> > use for many mutt users.
> > 
> > I'm including the current pkgsrc patches or that feature, if you want to
> > pick this up. The option name is not necessarily well chosen, so feel
> > free to do any change.
> 
> 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?


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"
 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~        Thu Apr 12 21:09:26 2007
+++ curs_main.c Thu Apr 12 21:25:48 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,6 +1067,11 @@
           cp = _("Open mailbox");
 
        buf[0] = '\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 (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)