Have you confirmed that this works in flycheck? http://flycheck.lunaryorn.com/Extending.html#Declaration-of-syntax-checkers suggests that you need to wrap the `(when)` in an `(eval)` because of how flycheck evaluates this value.