Next: , Previous: , Up: Top   [Contents][Index]

1 Using Flymake

Flymake is a universal on-the-fly buffer checker implemented as an Emacs minor mode. To use Flymake, you must first activate flymake-mode by using the command flymake-mode.

When enabled, Flymake collects information about problems in the buffer, called diagnostics, from one or more different sources, or backends, and then visually annotates the buffer by highlighting problematic buffer regions with a special face.

It also displays an overall buffer status in the mode line containing totals for different types of diagnostics.

Syntax check is done “on-the-fly”. It is started whenever

Syntax check can also be started manually by typing the M-x flymake-start RET command.

If the check detected errors or warnings, the respective buffer regions are highlighted. You can place point on those regions and use C-h . (display-local-help) to see what the specific problem was. Alternatively, hovering the mouse on those regions should also display a tool-tip with the same information.

flymake-goto-next-error and flymake-goto-prev-error are commands that allow easy navigation to the next/previous erroneous regions, respectively. If might be a good idea to map them to M-n and M-p in flymake-mode, by adding to your init file:

(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)

Flymake is a universal syntax checker in the sense that it’s easily extended to support new backends (see Extending Flymake).

Historically, Flymake used to accept diagnostics from a single backend, albeit a reasonably flexible one.

This backend isn’t (yet) obsolete, and so is still available as a fallback and active by default (see The legacy Proc backend). It works by selecting a syntax check tool from a preconfigured list (compiler for C++ files, perl for Perl files, etc.), and executing it in the background, passing it a temporary file which is a copy of the current buffer, and parsing the output for known error/warning message patterns.

Next: , Previous: , Up: Top   [Contents][Index]