Don't accept code from strangers

Or, this message will go to bogus

I should have done what the manual says: 6.4.6 Fancy Mail Splitting

For years, at least since 2008, but likely far longer, I’ve been splitting my mail building on someone else’s code that I got on the Internet. It worked, but it had a few quirks that I had not really noticed.

There’s a big difference between

"INBOX"))

and

("INBOX" "")))

placed at the end of

(setq nnimap-split-fancy
      '(|
      ("subject" "media alert" "INBOX.pressreleases")      
      [...]  snipped many lines
      (: (lambda ()
      (car (bbdb/gnus-split-method))))
      ;; Default mailbox
      "INBOX"))

Determined Adam Sjøgren encouraged me to edebug my nnimap-split-fancy code (see nnmail-mail-splitting-decodes). The manual is always right. In my defence, I’d like to say, “You can’t understand the manual, until you do.”

The code I took from a stranger comes with “”, and adds an extra pair of ().

Having both, doing gnus-summary-respool-trace (B t) on unsplitable messages will return:

(: (lambda nil (car (bbdb/gnus-split-method))))
message will go to mail.misc

Removing the "" while keeping the equally superfluous (), B t will return:

(: (lambda nil (car (bbdb/gnus-split-method))))
message will go to bogus

When removing both, following the example in the manual, B t will return:

(: (lambda nil (car (bbdb/gnus-split-method))))
message will go to INBOX

Which is cleaner: my IMAP folder collection includes neither mail.misc nor bogus, but an INBOX it has.

Avatar
Gijs Hillenius
Context for Digital Government

Policy specialist on open source in public services, knowlegde transfer expert

Related