Skip to content

Commit

Permalink
no need to check buffer-modified-tick
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Nov 4, 2022
1 parent b600c4d commit 3a928c6
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions flycheck.el
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,7 @@ Slots:
;; the focus hooks only work on Emacs 24.4 and upwards, but since undefined
;; hooks are perfectly ok we don't need a version guard here. They'll just
;; not work silently.
(post-command-hook . flycheck-maybe-display-error-at-point-soon)
(post-command-hook . flycheck-display-error-at-point-soon)
(focus-in-hook . flycheck-display-error-at-point-soon)
(focus-out-hook . flycheck-cancel-error-display-error-at-point-timer)
(post-command-hook . flycheck-hide-error-buffer)
Expand Down Expand Up @@ -5520,13 +5520,6 @@ non-nil."
(cancel-timer flycheck-display-error-at-point-timer)
(setq flycheck-display-error-at-point-timer nil)))

(defun flycheck--error-display-tick ()
"Return point and tick counter of current buffer."
(cons (point) (buffer-modified-tick)))

(defvar-local flycheck--last-error-display-tick nil
"Value of `flycheck--error-display-tick' when errors were last displayed.")

(defun flycheck-display-error-at-point ()
"Display all the error messages at point.

Expand All @@ -5536,26 +5529,17 @@ If there are no errors, clears the error messages at point."
;; errors
(with-demoted-errors "Flycheck error display error: %s"
(flycheck-cancel-error-display-error-at-point-timer)
(setq flycheck--last-error-display-tick (flycheck--error-display-tick))
(when flycheck-mode
(-if-let (errors (flycheck-overlay-errors-at (point)))
(flycheck-display-errors errors)
(flycheck-clear-displayed-errors)))))

(defun flycheck-display-error-at-point-soon ()
"Display error messages at point, with a delay."
(setq flycheck--last-error-display-tick nil)
(flycheck-maybe-display-error-at-point-soon))

(defun flycheck-maybe-display-error-at-point-soon ()
"Display error message at point with a delay, unless already displayed."
(flycheck-cancel-error-display-error-at-point-timer)
(when (and (not (equal flycheck--last-error-display-tick
(setq flycheck--last-error-display-tick
(flycheck--error-display-tick)))))
(setq flycheck-display-error-at-point-timer
(run-at-time flycheck-display-errors-delay nil
'flycheck-display-error-at-point))))
(setq flycheck-display-error-at-point-timer
(run-at-time flycheck-display-errors-delay nil
'flycheck-display-error-at-point)))


;;; Functions to display errors
Expand Down

0 comments on commit 3a928c6

Please sign in to comment.