Skip to content


Subversion checkout URL

You can clone with
Download ZIP


recursive maildir support #168

wants to merge 3 commits into from

2 participants


Currently, mu4s supports recursive maildirs of the form:
|-- A
| |-- B
| | |-- cur
| | |-- new
| | |-- tmp

but not of the form:
|-- A
| |-- cur
| |-- new
| |-- tmp
| |-- B
| | |-- cur
| | |-- new
| | |-- tmp

The latter form (somewhat similar to a Maildir++ (according to wiki) form)
is what occurs when Gmail nested labels are used with something like the
following (incomplete) offlineimaprc (note the sep = /):
[Repository gmail-local]
type = Maildir
localfolders = ~/Maildir
sep = /
nametrans = lambda folder: re.sub('Spam', '[Gmail]/Spam',
re.sub('Drafts', '[Gmail]/Drafts',
re.sub('Sent', '[Gmail]/Sent Mail',
re.sub('Starred', '[Gmail]/Starred',
re.sub('Trash', '[Gmail]/Trash',
re.sub('Important', '[Gmail]/Important',
re.sub('Archive', '[Gmail]/All Mail',

I was able to get the latter recursive form to work with the attached patch, which
modifies mu4e~get-maildirs-1.


Looks good!

I'd like to merge your patch in the dev branch; can you create a pull request against that one? Sadly, github doesn't allow me to change the target-branch :(


Re-submitted as #178. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2013
  1. @nicolasavru
Commits on Mar 17, 2013
  1. @nicolasavru
  2. @nicolasavru

    Merge branch 'recursive_maildirs' of

    nicolasavru authored
    …into recursive_maildirs
    rebase to master
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 mu4e/mu4e-utils.el
8 mu4e/mu4e-utils.el
@@ -245,7 +245,6 @@ Function will return the cdr of the list element."
(cdr chosen)
(mu4e-warn "Unknown shortcut '%c'" response))))
(defun mu4e~get-maildirs-1 (path mdir)
"Get maildirs under path, recursively, as a list of relative paths."
(let ((dirs)
@@ -258,8 +257,11 @@ Function will return the cdr of the list element."
(when (and (booleanp (cadr dentry)) (cadr dentry))
(if (file-accessible-directory-p
(concat mu4e-maildir "/" mdir "/" (car dentry) "/cur"))
- (setq dirs (cons (concat mdir (car dentry)) dirs))
- (setq dirs (append dirs (mu4e~get-maildirs-1 path
+ (setq dirs (cons (concat mdir (car dentry)) dirs)))
+ (if (not (or (string-equal "cur" (car dentry))
+ (string-equal "new" (car dentry))
+ (string-equal "tmp" (car dentry))))
+ (setq dirs (append dirs (mu4e~get-maildirs-1 path
(concat mdir (car dentry) "/")))))))
Something went wrong with that request. Please try again.