lunaryorn/flymake-checkers — pull request #2 by lunaryorn (2012-10-12 20:41:50+00:00)
Title: Refactor configuration and checkers

Make checker API and configuration awesome.

Called “new-style” API as opposed to the “old-style” API of `flymake-allowed-file-name-masks` and init functions in the following.

= Checker API

Use a declarative API to implement checkers:
```scheme
(defun flymake-checkers-coffee ()
"Provide a flymake checker for CoffeeScript."
(flymake-checkers-simple
:command '("coffeelint" "--csv" source)
:error-pattern '("\\(.+\\),\\([0-9]+\\),\\(?:warn\\|error\\),\\(.+\\)"
1 2 nil 3)))
```
Allow to configure command, error pattern and (later) possibly cleanup function all in one place.

= Checker registration

Use major mode to determine the checker to use:
```scheme
(add-to-list 'flymake-checkers-major-mode-checkers-alist '(coffee-mode . flymake-checkers-coffee))
```

= Setup API

Provide a separate minor mode to enable this new-style API, as compared to the old-style init functions and `flymake-allowed-file-name-masks`:
```scheme
(add-hook 'find-file-hook 'flymake-checkers-mode-on)
```

= Compatibility

flymake-checkers is now intentionally incompatible with the old-style flymake way of init functions and `flymake-allowed-file-name-masks`. Checkers are either looked up in `flymake-checkers-major-mode-checkers-alist` if `flymake-checkers-mode` is enabled, or in `flymake-allowed-file-name-masks` otherwise, but **never** in both of these.

This is to avoid confusion because of different ways of defining checkers, to prevent checking being spoiled by the broken built-in checkers of flymake, and to enforce the use of the new-style API which I consider superior.

Inviting @purcell to this discussion.