branch: elpa/flycheck
commit 42236eb481b549d17ccc0447f4fd34297e3a7f3b
Author: Ta Quang Trung <[email protected]>
Commit: GitHub <[email protected]>

    Add an option to control whether to display error at point after checking 
(#1987)
---
 CHANGES.rst                    |  1 +
 doc/user/error-interaction.rst | 12 ++++++++++++
 flycheck.el                    | 15 ++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/CHANGES.rst b/CHANGES.rst
index c1f8e420f1..6b58c0941b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -9,6 +9,7 @@ New Features
 - [#2055]: Add support for ``--expt-extended-lambda`` flag to ``cuda`` checker.
 - [#2035]: Added colors to FlyC mode line and updated mode line menu.
 - [#2059]: Enable checkers for new AUCTeX 14 modes.
+- [#1987]: Add a flag ``flycheck-auto-display-errors-after-checking`` control 
whether to display errors automatically after checking.
 
 -----------
 Bugs fixed
diff --git a/doc/user/error-interaction.rst b/doc/user/error-interaction.rst
index ae2bb0bc3e..1c50e7019b 100644
--- a/doc/user/error-interaction.rst
+++ b/doc/user/error-interaction.rst
@@ -96,6 +96,18 @@ Flycheck errors at point after a short delay which you can 
customise:
    The number of seconds to wait before displaying the error at point. Floating
    point numbers can express fractions of seconds.
 
+You can also disable Flycheck from automatically displaying errors at point by
+customising:
+
+.. defcustom:: flycheck-auto-display-errors-after-checking
+
+   Whether to automatically display errors at the current point after checking.
+
+   When being set to `nil`, it will prevent Flycheck from automatically 
displaying
+   error messages. This setting is useful when Flycheck is used together with
+   `flycheck-posframe`, to prevent `flycheck-posframe` from repeatedly 
displaying
+   errors at point.
+
 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:
diff --git a/flycheck.el b/flycheck.el
index e8b22235df..83f5e78801 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -387,6 +387,18 @@ node `(elisp)Hooks'."
   :package-version '(flycheck . "0.13")
   :risky t)
 
+(defcustom flycheck-auto-display-errors-after-checking t
+  "Whether to automatically display errors at the current point after checking.
+
+When being set to `nil', it will prevent Flycheck from automatically displaying
+error messages. This setting is useful when Flycheck is used together with
+`flycheck-posframe', to prevent `flycheck-posframe' from repeatedly displaying
+errors at point."
+  :group 'flycheck
+  :type 'boolean
+  :package-version '(flycheck . "35")
+  :safe #'booleanp)
+
 (defcustom flycheck-display-errors-delay 0.9
   "Delay in seconds before displaying errors at point.
 
@@ -3319,7 +3331,8 @@ WORKING-DIR."
         (flycheck-delete-marked-overlays)
         (flycheck-error-list-refresh)
         (run-hooks 'flycheck-after-syntax-check-hook)
-        (when (eq (current-buffer) (window-buffer))
+        (when (and flycheck-auto-display-errors-after-checking
+                   (eq (current-buffer) (window-buffer)))
           (flycheck-display-error-at-point))
         ;; Immediately try to run any pending deferred syntax check, which
         ;; were triggered by intermediate automatic check event, to make sure

Reply via email to