9.3 Contexts and special folders

As we discussed in Folders and Dynamic folders, mu4e recognizes a number of special folders: mu4e-sent-folder, mu4e-drafts-folder, mu4e-trash-folder and mu4e-refile-folder.

When you have a headers-buffer with messages that belong to different contexts (say, a few different accounts), it is desirable for each of them to use the specific folders for their own context — so, for instance, if you trash a message, it needs to go to the trash-folder for the account it belongs to, which is not necessarily the current context.

To make this easy to do, whenever mu4e needs to know the value for such a special folder for a given message, it tries to determine the appropriate context using mu4e-context-determine (and policy nil; see Context policies). If it finds a matching context, it let-binds the vars for that account, and then determines the value for the folder. It does not, however, call the enter-func or leave-func, since we are not really switching contexts.

In practice, this means that as long as each of the accounts has a good match-func, all message operations automatically find the appropriate folders.