I'm trying to write fancy split that puts any message with "[foobar]" in the subject into a specific folder but nothing seems to work.

I have:

(setq nnimap-split-fancy '(|("subject" "\\[foobar\\]" "INBOX.foobar")

but it still ends up in the "default" mailbox.

If I change the regexp to just "foobar" it works (but then it matches other messages I don't want included). I think it's something to do with the escaping of the brackets. I've tried a couple of different of variations of escaping but there's something I'm missing. Or maybe I'm not fancy enough.

  • 1
    Did you set nnmail-split-methods to nnmail-split-fancy? Commented Aug 6, 2015 at 18:37
  • Tassilo Horn: Yep. It works if I do just "foobar" or "f.*bar". I just can't seem to escape the brackets properly.
    – seth
    Commented Aug 7, 2015 at 22:48
  • That's strange. Given that this is a regular expression, they are in fact quoted correctly... Commented Aug 8, 2015 at 6:57
  • Maybe gnus is doing something to the subject with the brackets at the beginning?
    – seth
    Commented Aug 13, 2015 at 19:09
  • I don't know. You could figure out which function evaluates the fancy splits and edebug it in order to see what's happening exactly. Commented Aug 13, 2015 at 19:15

1 Answer 1


Finally figured this out.

Had to use:

(setq nnimap-split-fancy '(|("subject" "\\[foobar]" "INBOX.foobar")
  • Please accept your own answer so that the robots don't keep placing this question periodically on the Active list.
    – lawlist
    Commented Sep 18, 2015 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.