Function: flymake--diagnostics-next-error

flymake--diagnostics-next-error is a byte-compiled function defined in flymake.el.gz.

Signature

(flymake--diagnostics-next-error N &optional RESET)

Documentation

next-error-function for flymake diagnostics buffers.

N is an integer representing how many errors to move. If RESET is non-nil, return to the beginning of the errors before moving.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake--diagnostics-next-error (n &optional reset)
  "`next-error-function' for flymake diagnostics buffers.
N is an integer representing how many errors to move.
If RESET is non-nil, return to the beginning of the errors before
moving."
  (let ((line (if reset 1 flymake-current-diagnostic-line))
        (total-lines (count-lines (point-min) (point-max))))
    (goto-char (point-min))
    (unless (zerop total-lines)
      (let ((target-line (+ line n)))
        (setq target-line (max 1 target-line))
        (setq target-line (min target-line total-lines))
        (forward-line (1- target-line))))
    (when-let* ((win (get-buffer-window nil t)))
      (set-window-point win (point)))
    (flymake-goto-diagnostic (point))))