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.  It is unbound by default.

Signed-off-by: Corey Minyard <miny...@acm.org>
---
Sigh, I should have read the commit message before submitting...

Changes since v3:

Fix the commit message to remove the ">" binding.

Changes since v2:

Get rid of force_descend_dir and just directly check the op when
using this function.  force_descend_dir wasn't being reset at the
end of the loop, and this is simpler, anyway.

Don't default the function.  ">" was already in use.

-corey

 OPS                 | 1 +
 browser.c           | 3 ++-
 doc/manual.xml.head | 8 ++++++++
 functions.h         | 1 +
 4 files changed, 12 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..e95dbdcb 100644
--- a/browser.c
+++ b/browser.c
@@ -769,6 +769,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, 
char ***files, int *num
   {
     switch (i = mutt_menuLoop (menu))
     {
+      case OP_DESCEND_DIRECTORY:
       case OP_GENERIC_SELECT_ENTRY:
 
        if (!state.entrylen)
@@ -800,7 +801,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 (i == OP_DESCEND_DIRECTORY || (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..e3da882a 100644
--- a/doc/manual.xml.head
+++ b/doc/manual.xml.head
@@ -403,6 +403,14 @@ 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 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..9a039455 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,   NULL },
   { "display-filename",        OP_BROWSER_TELL,        "@" },
   { "enter-mask",      OP_ENTER_MASK,          "m" },
   { "sort",            OP_SORT,                "o" },
-- 
2.17.1

Reply via email to