Flycheck provides on-the-fly syntax checking for GNU Emacs 24. Essentially it's “flymake done right” with
- major-mode based checkers (instead of file name patterns),
- simple declarative checker definitions (instead of init functions),
- ready-to-use syntax checkers for a bunch of languages (instead of broken checkers using non-existing tools),
- and a clean, concise and understandable implementation (instead of a almost 2k line mess of spaghetti code).
And this is how it looks like (the color theme is solarized-light):
- Automatic syntax check after saving or insertion of new lines
- Error navigation with
- Built-in syntax checkers for:
- Emacs Lisp
- Shell scripts (Bash, Dash and Zsh)
- Easy customization (see
- Easy declarative API to define new syntax checkers
Flycheck is written and tested against GNU Emacs 24.2 and newer. It should work on Emacs 24.1, too. GNU Emacs 23 and before, and other flavors of Emacs (e.g. XEmacs) are not supported.
Most checkers have dependencies against external tools that perform the
C-c ! ? to see what a checker needs, e.g.
C-c ! ?
This section provides a short introduction to Flycheck. For complete
documentation, including the declaration of new syntax checkers, refer to the
Info manual of Flycheck. Open the manual with
C-c ! i.
flycheck-mode in your
init.el file for all text editing and
(add-hook 'prog-mode-hook 'flycheck-mode) (add-hook 'text-mode-hook 'flycheck-mode)
You may also enable Flycheck manually after visiting a file with
flycheck-mode the buffer is automatically checked on-the-fly. You can also
check the buffer manually with
C-c ! c.
A suitable syntax checker is automatically selected from the list of registered
C-c ! s to manually select a specific
syntax checker, or configure the syntax checker per file by setting
flycheck-checker as file local variable::
# Local Variables: # flycheck-checker: python-pylint # End:
Some syntax checkers read configuration files. Use
M-x customize-group RET
flycheck-config-files to customize these. Refer to the section Configuration
in the Flycheck info manual.
Errors and warnings from the syntax checker are reported in the mode line,
highlighted in the buffer and indicated with icons in the fringe. Customize
flycheck-highlighting-mode to change the highlighting of errors. Refer to the
sections Reporting and Mode line for more information.
Note: The default highlighting faces provided GNU Emacs are ill-suited to highlight errors. They are too easily overlooked. Make sure to customize these faces to add a striking background color or an underlying, or choose a color theme with reasonable Flycheck faces, for instance the excellent light or dark solarized themes.
M-g n and
M-g p to navigate between errors. If the point is on an
error, the error message is shown in the echo area after a short delay. You may
also hover the mouse over a highlighted error to get a tooltip with the error
message. See Reporting for more information.
Note: Visible compilation buffers take preference over buffers with
Flycheck errors. This includes buffers from
M-x grep and
generally all buffers with Compilation Mode or Compilation Minor Mode enabled.
If such a buffer is visible
previous-error will navigate the
errors (or grep results) reported by this buffer instead. Hide this buffer
delete-other-windows) to navigate Flycheck errors again.
The following people contributed to flycheck:
- Bozhidar Batsov provided valuable feedback and refinements, and brought Flycheck to a larger user base by adding it to his awesome Prelude project.
- Damon Haley helped to shape and test the PHP CodeSniffer checker.
- Marian Schubert added the Perl syntax checker.
- Martin Grenfell created the awesome Vim library syntastic which inspired this project and many of its checkers.
- Peter Vasil created the XML and Lua syntax checkers, added unit tests and did valuable testing.
- steckerhalter provided the PHP CodeSniffer checker.
- Steve Purcell implemented many checkers, contributed important ideas to the design of the checker API and engaged in worthwhile discussion to shape this project.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYING for details.