Function: flymake-goto-next-error
flymake-goto-next-error is an interactive and byte-compiled function
defined in flymake.el.gz.
Signature
(flymake-goto-next-error &optional N FILTER INTERACTIVE)
Documentation
Go to Nth next Flymake diagnostic that matches FILTER.
Interactively, always move to the next diagnostic. With a prefix arg, skip any diagnostics with a severity less than :warning.
If flymake-wrap-around is non-nil and no more next diagnostics,
resumes search from top.
FILTER is a list of diagnostic types. Only diagnostics with matching severities matching are considered. If nil (the default) no filter is applied.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake-goto-next-error (&optional n filter interactive)
"Go to Nth next Flymake diagnostic that matches FILTER.
Interactively, always move to the next diagnostic. With a prefix
arg, skip any diagnostics with a severity less than `:warning'.
If `flymake-wrap-around' is non-nil and no more next diagnostics,
resumes search from top.
FILTER is a list of diagnostic types. Only diagnostics with
matching severities matching are considered. If nil (the
default) no filter is applied."
;; TODO: let filter be a number, a severity below which diags are
;; skipped.
(interactive (list 1
(if current-prefix-arg
'(:error :warning))
t))
(let* ((n (or n 1))
(ovs (cl-loop
for o in (overlays-in (point-min) (point-max))
for diag = (overlay-get o 'flymake-diagnostic)
when (and diag (or (not filter) (cl-find
(flymake--severity
(flymake-diagnostic-type diag))
filter :key #'flymake--severity)))
collect o into retval
finally (cl-return
(cl-sort retval (if (cl-plusp n) #'< #'>)
:key #'overlay-start))))
(tail (cl-member-if (lambda (ov)
(if (cl-plusp n)
(> (overlay-start ov)
(point))
(< (overlay-start ov)
(point))))
ovs))
(chain (if flymake-wrap-around
(if tail
(progn (setcdr (last tail) ovs) tail)
(and ovs (setcdr (last ovs) ovs)))
tail))
(target (nth (1- n) chain)))
(cond (target
(goto-char (overlay-start target))
(when interactive
(message
"%s"
(funcall (overlay-get target 'help-echo)
(selected-window) target (point)))))
(interactive
(user-error "No more Flymake diagnostics%s"
(if filter
(format " of %s severity"
(mapconcat #'symbol-name filter ", ")) ""))))))