Flycheck provides two Emacs minor modes for automatic syntax checking:
Flycheck Mode to enable syntax checking in the current buffer, and
Global Flycheck Mode to enable syntax checking in all buffers whenever
Global Flycheck Mode¶
Flycheck Modein all buffers where syntax checking is possible.
This mode does not enable
Flycheck Modein remote files (via TRAMP) and encrypted files. Checking remote files may be very slow depending on the network connections, and checking encrypted files would leak confidential data to temporary files and subprocesses.
You can manually enable
Flycheck Modein these buffers nonetheless, but we do not recommend this for said reasons.
Add the following to your init file to enable syntax checking permanently:
(add-hook 'after-init-hook #'global-flycheck-mode)
You can exclude specific major modes from syntax checking with
Flycheck Modeon for all major modes.
Flycheck Modeon for all major modes in this list, i.e. whenever the value of
major-modeis contained in this list.
(not foo-mode …)
Flycheck Modeon for all major nodes not in this list, i.e. whenever the value of
major-modeis not contained in this list.
Global Flycheck Modenever turns on
Flycheck Modein major modes whose
special, regardless of the value of this option. Syntax checking simply makes no sense in special buffers which are typically intended for non-interactive display rather than editing.
- Major Mode Conventions(elisp)
- Information about major modes, and modes marked as special.
Flycheck Mode automatically checks a buffer whenever
- it is enabled,
- the buffer is saved,
- a new line is inserted,
- or a short time after the last change was made in a buffer.
You can customise this behaviour with
A list of events which trigger a syntax check in the current buffer:
- Check the buffer immediately after it was saved.
- Check the buffer immediately after a new line was inserted.
Check the buffer a short time after the last change. The delay is customisable with
Seconds to wait after the last change to the buffer before starting a syntax check.
- Check the buffer immediately after
Flycheck Modewas enabled.
For instance with the following setting
Flycheck Modewill only check the buffer when it was saved:
(setq flycheck-check-syntax-automatically '(mode-enabled save))