Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flycheck-error-level-interesting-p #1870

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions flycheck.el
Original file line number Diff line number Diff line change
Expand Up @@ -4652,17 +4652,34 @@ level."
(flycheck-has-max-errors-p flycheck-current-errors level))

(defun flycheck-has-errors-p (errors level)
"Determine if there are any ERRORS with LEVEL."
"Determine if there are any ERRORS with exactly LEVEL."
(seq-some (lambda (e) (eq (flycheck-error-level e) level)) errors))

(defun flycheck-has-errors-atleast-p (errors level)
"Determine if there are any ERRORS with at least LEVEL."
(seq-some (lambda (e)
(>= (flycheck-error-level-severity (flycheck-error-level e))
(flycheck-error-level-severity level)))
errors))

(defun flycheck-has-current-errors-p (&optional level)
"Determine if the current buffer has errors with LEVEL.
"Determine if the current buffer has any errors with exactly LEVEL.

If LEVEL is omitted if the current buffer has any errors at all."
If LEVEL is omitted, then return whether the current buffer has any errors at
all."
(if level
(flycheck-has-errors-p flycheck-current-errors level)
(and flycheck-current-errors t)))

(defun flycheck-has-current-errors-atleast-p (&optional level)
"Determine if the current buffer has any errors with at least LEVEL.

If LEVEL is omitted, then return whether the current buffer has any errors at
all."
(if level
(flycheck-has-errors-atleast-p flycheck-current-errors level)
(and flycheck-current-errors t)))


;;; Error overlays in the current buffer
(defvar-local flycheck--last-overlay-index 0
Expand Down Expand Up @@ -4851,7 +4868,7 @@ no errors as or more severe than `flycheck-navigation-minimum-level'."
(-if-let (min-level flycheck-navigation-minimum-level)
(or (<= (flycheck-error-level-severity min-level)
(flycheck-error-level-severity (flycheck-error-level err)))
(not (flycheck-has-current-errors-p min-level)))
(not (flycheck-has-current-errors-atleast-p min-level)))
t)))

(defun flycheck-next-error-pos (n &optional reset)
Expand Down