Function: compilation-next-error-function
compilation-next-error-function is an autoloaded, interactive and
byte-compiled function defined in compile.el.gz.
Signature
(compilation-next-error-function N &optional RESET)
Documentation
Advance to the next error message and visit the file where the error was.
This is the value of next-error-function in Compilation buffers.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
;;;###autoload
(defun compilation-next-error-function (n &optional reset)
"Advance to the next error message and visit the file where the error was.
This is the value of `next-error-function' in Compilation buffers."
(interactive "p")
(when reset
(setq compilation-current-error nil))
(let* ((screen-columns compilation-error-screen-columns)
(first-column compilation-first-column)
(msg (compilation-next-error (or n 1) nil
(or compilation-current-error
compilation-messages-start
(point-min))))
(loc (compilation--message->loc msg))
(end-loc (compilation--message->end-loc msg))
(marker (point-marker)))
(unless loc
(user-error "No next error"))
(setq compilation-current-error (point-marker)
overlay-arrow-position
(if (bolp)
compilation-current-error
(copy-marker (line-beginning-position))))
;; If loc contains no marker, no error in that file has been visited.
;; If the marker is invalid the buffer has been killed.
;; So, recalculate all markers for that file.
(unless (and (compilation--loc->marker loc)
(marker-buffer (compilation--loc->marker loc))
;; FIXME-omake: For "omake -P", which automatically recompiles
;; when the file is modified, the line numbers of new output
;; may not be related to line numbers from earlier output
;; (earlier markers), so we used to try to detect it here and
;; force a reparse. But that caused more problems elsewhere,
;; so instead we now flush the file-structure when we see
;; omake's message telling it's about to recompile a file.
;; (or (null (compilation--loc->timestamp loc)) ;A fake-loc
;; (equal (compilation--loc->timestamp loc)
;; (setq timestamp compilation-buffer-modtime)))
)
(compilation--update-markers loc marker screen-columns first-column))
(compilation-goto-locus marker (compilation--loc->marker loc)
(compilation--loc->marker end-loc))
(setf (compilation--loc->visited loc) t)))