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

See also

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.

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.

C-c ! e
M-x flycheck-explain-error-at-point

Display an explanation for the first explainable error at point.

Kill errors

You can put errors into the kill ring with C-c ! w:

C-c ! w
M-x flycheck-copy-errors-as-kill

Copy all messages of the errors at point into the kill ring.

C-u C-c ! w
C-u M-x flycheck-copy-errors-as-kill

Like C-c ! w but with error IDs.

M-0 C-c ! w
M-0 M-x flycheck-copy-errors-as-kill

Like C-c ! w but do not copy the error messages but only the error IDs.