branch: elpa/flycheck
commit 3c0010fb20cd4b43953fb73dbea8425b761891cc
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Document remote checking over TRAMP
Update the global-flycheck-mode and flycheck-versus-flymake notes now
that remote files are checked by default, and document the new
flycheck-check-syntax-automatically-remote option. Add a changelog
entry for [#1816].
---
CHANGES.rst | 9 +++++++++
doc/user/flycheck-versus-flymake.rst | 4 ++--
doc/user/syntax-checks.rst | 28 ++++++++++++++++++++++------
3 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index 1d44f03ec6..37a9ce519a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,15 @@
``master`` (unreleased)
=======================
+- [#1816]: Flycheck now runs syntax checkers over TRAMP. When a buffer
+ visits a remote file, command checkers execute on the remote host
+ (their executables must be installed there) instead of being unable to
+ run. ``global-flycheck-mode`` enables Flycheck in remote buffers by
+ default. Because each check spawns a remote process, remote buffers
+ are checked on fewer triggers by default (``save`` and
+ ``mode-enabled``); customize
+ ``flycheck-check-syntax-automatically-remote`` to change this. Builds
+ on the earlier work in [#1842].
37.0 (2026-07-18)
=================
diff --git a/doc/user/flycheck-versus-flymake.rst
b/doc/user/flycheck-versus-flymake.rst
index 5c0403b44b..9db3b0874d 100644
--- a/doc/user/flycheck-versus-flymake.rst
+++ b/doc/user/flycheck-versus-flymake.rst
@@ -113,8 +113,8 @@ it for all ``prog-mode`` buffers. If no backends for the
major mode are
available, Flymake will non-intrusively tell you in the modeline.
**Flycheck** provides a global mode `global-flycheck-mode` which enables syntax
-checking in every supported language, where it is safe to do so (remote and
-encrypted buffers are excluded by default).
+checking in every supported language, including remote files over TRAMP
+(encrypted buffers are excluded by default).
Syntax checkers
---------------
diff --git a/doc/user/syntax-checks.rst b/doc/user/syntax-checks.rst
index 3e2b147f94..d393274220 100644
--- a/doc/user/syntax-checks.rst
+++ b/doc/user/syntax-checks.rst
@@ -20,13 +20,16 @@ possible.
.. note::
- This mode does not enable :mode:`flycheck` in 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.
+ Remote files (via TRAMP) are checked like local ones: command checkers
+ run on the remote host, so the tools need to be installed there rather
+ than locally. Because each check spawns a process over the network,
+ remote buffers are checked on fewer triggers by default; see
+ `flycheck-check-syntax-automatically-remote`.
- You can manually enable :mode:`flycheck` in these buffers nonetheless,
but
- we do *not* recommend this for said reasons.
+ This mode does not enable :mode:`flycheck` in encrypted files, as
+ checking them would leak confidential data to temporary files and
+ subprocesses. You can manually enable :mode:`flycheck` in these buffers
+ nonetheless, but we do *not* recommend it for said reason.
Add the following to your :term:`init file` to enable syntax checking
permanently:
@@ -133,6 +136,19 @@ You can customise this behaviour with
`flycheck-check-syntax-automatically`:
(setq flycheck-check-syntax-automatically '(mode-enabled save))
+.. defcustom:: flycheck-check-syntax-automatically-remote
+
+ The same as `flycheck-check-syntax-automatically`, but for buffers visiting
+ remote files (see `file-remote-p`). Checking a remote buffer spawns a
+ process on the remote host over TRAMP, which is slow, so by default the
+ change-driven triggers (``idle-change``, ``new-line`` and
+ ``idle-buffer-switch``) are excluded and remote buffers are only checked on
+ ``save`` and ``mode-enabled``.
+
+ Set it to ``t`` to check remote buffers on the same events as local ones.
+ A manual check with :command:`flycheck-buffer` (:kbd:`C-c ! c`) always
+ works regardless of this option.
+
When a change-driven syntax check (``idle-change`` or ``save``) is triggered
while a recently started check is still running, the running check is
interrupted and the new one starts immediately, since its results would no