From: Corey Minyard <cminy...@mvista.com>

Some (maybe most) IMAP mail systems allow folders to be nested inside
folders, so you can have, say, an Inbox with more folders inside it.
However, in the file browser, mutt will only open a maildir/mh
directory as a mailbox, there is no way to get to the child mailboxes.

This change adds a function <descend-directory> that forces mutt to
descend into the directory, and it binds it to ">" by default in
the file browser.

Signed-off-by: Corey Minyard <miny...@acm.org>
---
 OPS                 | 1 +
 browser.c           | 6 +++++-
 doc/manual.xml.head | 9 +++++++++
 functions.h         | 1 +
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/OPS b/OPS
index e9779874..5c28c536 100644
--- a/OPS
+++ b/OPS
@@ -186,3 +186,4 @@ OP_CHECK_STATS "calculate message statistics for all 
mailboxes"
 OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
 OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
 OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
+OP_DESCEND_DIRECTORY "descend into a directdory"
diff --git a/browser.c b/browser.c
index cb30f829..d70e3f9c 100644
--- a/browser.c
+++ b/browser.c
@@ -656,6 +656,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, 
char ***files, int *num
   int multiple = (flags & MUTT_SEL_MULTI)  ? 1 : 0;
   int folder   = (flags & MUTT_SEL_FOLDER) ? 1 : 0;
   int buffy    = (flags & MUTT_SEL_BUFFY)  ? 1 : 0;
+  int force_descend_dir = 0;
 
   buffy = buffy && folder;
 
@@ -769,6 +770,9 @@ void _mutt_select_file (char *f, size_t flen, int flags, 
char ***files, int *num
   {
     switch (i = mutt_menuLoop (menu))
     {
+      case OP_DESCEND_DIRECTORY:
+       force_descend_dir = 1;
+
       case OP_GENERIC_SELECT_ENTRY:
 
        if (!state.entrylen)
@@ -800,7 +804,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, 
char ***files, int *num
          else
            mutt_concat_path (buf, LastDir, state.entry[menu->current].name, 
sizeof (buf));
 
-         if ((mx_get_magic (buf) <= 0)
+         if (force_descend_dir || (mx_get_magic (buf) <= 0)
 #ifdef USE_IMAP
               || state.entry[menu->current].inferiors
 #endif
diff --git a/doc/manual.xml.head b/doc/manual.xml.head
index cb22736a..2b8c4642 100644
--- a/doc/manual.xml.head
+++ b/doc/manual.xml.head
@@ -403,6 +403,15 @@ for easy navigation through the file system when selecting 
file(s) to
 attach to a message, select multiple files to attach and many more.
 </para>
 
+<para>
+Some mail systems can nest mail folders inside other mail folders.
+The normal open entry commands in mutt will open the mail folder
+and you can't see the sub-folders.  If you instead use the
+<literal>&lt;descend-directory&gt;</literal> function (normally
+bound to <literal>&gt;</literal>) it will go into the directory
+and not open it as a mail directory.
+</para>
+
 </sect2>
 
 <sect2 id="intro-sidebar">
diff --git a/functions.h b/functions.h
index 33f3a07b..1a93374b 100644
--- a/functions.h
+++ b/functions.h
@@ -403,6 +403,7 @@ const struct binding_t OpAlias[] = { /* map: alias */
 /* The file browser */
 const struct binding_t OpBrowser[] = { /* map: browser */
   { "change-dir",      OP_CHANGE_DIRECTORY,    "c" },
+  { "descend-mailbox", OP_DESCEND_DIRECTORY,   ">" },
   { "display-filename",        OP_BROWSER_TELL,        "@" },
   { "enter-mask",      OP_ENTER_MASK,          "m" },
   { "sort",            OP_SORT,                "o" },
-- 
2.17.1

Reply via email to