Interact with errors¶
There are a couple of things that you can do with Flycheck errors in a buffer:
You can navigate to errors, and go to the next or previous error.
You can display errors to read their error messages.
You can put error messages and IDs into the kill ring.
This section documents the corresponding commands and their customisation options.
Display errors¶
Whenever you move point to an error location Flycheck automatically displays all Flycheck errors at point after a short delay which you can customise:
- defcustom flycheck-display-errors-delay¶
The number of seconds to wait before displaying the error at point. Floating point numbers can express fractions of seconds.
By default Flycheck shows the error messages in the minibuffer or in a separate buffer if the minibuffer is too small to hold the whole error message but this behaviour is entirely customisable:
- defcustom flycheck-display-errors-function¶
A function to display errors.
The function is given the list of Flycheck errors to display as sole argument and shall display these errors to the user in some way.
Flycheck provides two built-in functions for this option:
- defun flycheck-display-error-messages errors¶
- defun flycheck-display-error-messages-unless-error-list errors¶
Show error messages and IDs in the echo area or in a separate buffer if the echo area is too small (using
display-message-or-buffer
which see). The latter only displays errors when the error list is not visible. To enable it add the following to your init file:(setq flycheck-display-errors-function #'flycheck-display-error-messages-unless-error-list)
See also
- flycheck-pos-tip
A Flycheck extension to display errors in a GUI popup.
Additionally Flycheck shows errors in a GUI tooltip whenever you hover an error location with the mouse pointer. By default the tooltip contains the messages and IDs of all errors under the pointer, but the contents are customisable:
- defcustom flycheck-help-echo-function¶
A function to create the contents of the tooltip.
The function is given a list of Flycheck errors to display as sole argument and shall return a single string to use as the contents of the tooltip.
Errors from other files¶
Some checkers may return errors from files other than the current buffer (e.g.,
gcc
may complain about errors in included files). These errors appear in the
error list, and are also added on the first line of the current buffer. You can
jump to the incriminating files with flycheck-previous-error
.
By default, warnings and info messages from other files are ignored, but you can customize the minimum level:
- defcustom flycheck-relevant-error-other-file-minimum-level¶
The minimum level errors from other files to consider for inclusion in the current buffer.
If set to an error level, only display errors from other files whose error level is at least as severe as this one. If
nil
, display all errors from other files.
To never show any errors from other files, set
flycheck-relevant-error-other-file-show
to nil
.
- defcustom flycheck-relevant-error-other-file-show¶
Whether to show errors from other files.
Explain errors¶
Flycheck also has the ability to display explanations for errors, provided the
error checker is capable of producing these explanations. Currently, only the
rust
and rust-cargo
checkers produce explanations.
Kill errors¶
You can put errors into the kill ring with C-c ! w
: