Function: compilation-next-error
compilation-next-error is an interactive and byte-compiled function
defined in compile.el.gz.
Signature
(compilation-next-error N &optional DIFFERENT-FILE PT)
Documentation
Move point to the next error in the compilation buffer.
This function does NOT find the source line like C-x ` (next-error).
Prefix arg N says how many error messages to move forwards (or
backwards, if negative).
Optional arg DIFFERENT-FILE, if non-nil, means find next error for a
file that is different from the current one.
Optional arg PT, if non-nil, specifies the value of point to start
looking for the next message.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defun compilation-next-error (n &optional different-file pt)
"Move point to the next error in the compilation buffer.
This function does NOT find the source line like \\[next-error].
Prefix arg N says how many error messages to move forwards (or
backwards, if negative).
Optional arg DIFFERENT-FILE, if non-nil, means find next error for a
file that is different from the current one.
Optional arg PT, if non-nil, specifies the value of point to start
looking for the next message."
(interactive "p")
(or (compilation-buffer-p (current-buffer))
(error "Not in a compilation buffer"))
(or pt (setq pt (point)))
(compilation--ensure-parse pt)
(let* ((msg (get-text-property pt 'compilation-message))
;; `loc', `msg', and `last' are used by the compilation-loop macro.
(loc (and msg (compilation--message->loc msg)))
last)
(if (zerop n)
(unless (or msg ; find message near here
(setq msg (get-text-property (max (1- pt) (point-min))
'compilation-message)))
(setq pt (previous-single-property-change pt 'compilation-message nil
(line-beginning-position)))
(unless (setq msg (get-text-property (max (1- pt) (point-min))
'compilation-message))
(setq pt (compilation-next-single-property-change
pt 'compilation-message nil
(line-end-position)))
(or (setq msg (get-text-property pt 'compilation-message))
(setq pt (point)))))
(setq last (compilation--loc->file-struct loc))
(if (>= n 0)
(compilation-loop > compilation-next-single-property-change 1-
(if (get-buffer-process (current-buffer))
"No more %ss yet"
"Past last %s")
(point-max))
;; Don't move "back" to message at or before point.
;; Pass an explicit (point-min) to make sure pt is non-nil.
(setq pt (previous-single-property-change
pt 'compilation-message nil (point-min)))
(compilation-loop < previous-single-property-change 1+
"Moved back before first %s" (point-min))))
(goto-char pt)
(or msg
(user-error "No %s here" compilation-error))))