7.3 Maildir searches

Maildir searches are quite similar to bookmark searches (see Bookmarks), with the difference being that the target is always a maildir — maildir queries provide a ‘traditional’ folder-like interface to a search-based e-mail client. By default, maildir searches are available in the The main view, The headers view, and The message view, with the key j (mu4e-jump-to-maildir). If a prefix argument is given, the maildir query can be refined before execution.

7.3.1 Setting up maildir shortcuts

You can search for maildirs like any other message property (e.g. with a query like maildir:/myfolder), but since it is so common, mu4e offers a shortcut for this.

For this to work, you need to set the variable mu4e-maildir-shortcuts to the list of maildirs you want to have quick access to, for example:

(setq mu4e-maildir-shortcuts
  '( (:maildir "/inbox"     :key  ?i)
     (:maildir "/archive"   :key  ?a)
     (:maildir "/lists"     :key  ?l)
     (:maildir "/work"      :key  ?w)
     (:maildir "/sent"      :key  ?s)
     (:maildir "/lists/project/project_X" :key ?x :name "Project X")))

This sets i as a shortcut for the /inbox folder — effectively a query maildir:/inbox. There is a special shortcut o or / for other (so don’t use those for your own shortcuts!), which allows you to choose from all maildirs that you have. There is support for autocompletion; note that the list of maildirs is determined when mu4e starts; if there are changes in the maildirs while mu4e is running, you need to restart mu4e. Optionally, you can specify a name to be displayed in the main view.

Each of the folder names is relative to your top-level maildir directory; so if you keep your mail in ~/Maildir, /inbox would refer to ~/Maildir/inbox. With these shortcuts, you can jump around your maildirs (folders) very quickly — for example, getting to the /lists folder only requires you to type jl, then change to /work with jw.

While in queries you need to quote folder names (maildirs) with spaces in them, you should not quote them when used in mu4e-maildir-shortcuts, since mu4e does that automatically for you.

The very same shortcuts are used by M-x mu4e-mark-for-move (default shortcut m); so, for example, if you want to move a message to the /archive folder, you can do so by typing ma.