Function: next-error
next-error is an interactive and byte-compiled function defined in
simple.el.gz.
Signature
(next-error &optional ARG RESET)
Documentation
Visit next next-error message and corresponding source code.
If all the error messages parsed so far have been processed already, the message buffer is checked for new ones.
A prefix ARG specifies how many error messages to move;
negative means move back to previous error messages.
Just C-u (universal-argument) as a prefix means reparse the error message buffer
and start at the first error.
The RESET argument specifies that we should restart from the beginning.
C-x ` (next-error) normally uses the most recently started
compilation, grep, or occur buffer. It can also operate on any
buffer with output from the M-x compile (compile), M-x grep (grep) commands, or,
more generally, on any buffer in Compilation mode or with
Compilation Minor mode enabled, or any buffer in which
next-error-function is bound to an appropriate function.
To specify use of a particular buffer for error messages, type
C-x ` (next-error) in that buffer. You can also use the command
next-error-select-buffer to select the buffer to use for the subsequent
invocation of next-error.
Once C-x ` (next-error) has chosen the buffer for error messages, it
runs next-error-hook with run-hooks, and stays with that buffer
until you use it in some other buffer that uses Compilation mode
or Compilation Minor mode.
To control which errors are matched, customize the variable
compilation-error-regexp-alist.
Probably introduced at or before Emacs version 20.1.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun next-error (&optional arg reset)
"Visit next `next-error' message and corresponding source code.
If all the error messages parsed so far have been processed already,
the message buffer is checked for new ones.
A prefix ARG specifies how many error messages to move;
negative means move back to previous error messages.
Just \\[universal-argument] as a prefix means reparse the error message buffer
and start at the first error.
The RESET argument specifies that we should restart from the beginning.
\\[next-error] normally uses the most recently started
compilation, grep, or occur buffer. It can also operate on any
buffer with output from the \\[compile], \\[grep] commands, or,
more generally, on any buffer in Compilation mode or with
Compilation Minor mode enabled, or any buffer in which
`next-error-function' is bound to an appropriate function.
To specify use of a particular buffer for error messages, type
\\[next-error] in that buffer. You can also use the command
`next-error-select-buffer' to select the buffer to use for the subsequent
invocation of `next-error'.
Once \\[next-error] has chosen the buffer for error messages, it
runs `next-error-hook' with `run-hooks', and stays with that buffer
until you use it in some other buffer that uses Compilation mode
or Compilation Minor mode.
To control which errors are matched, customize the variable
`compilation-error-regexp-alist'."
(interactive "P")
(if (consp arg) (setq reset t arg nil))
(let ((buffer (next-error-find-buffer)))
(when buffer
;; We know here that next-error-function is a valid symbol we can funcall
(with-current-buffer buffer
(funcall next-error-function (prefix-numeric-value arg) reset)
(let ((prev next-error-last-buffer))
(next-error-found buffer (current-buffer))
(when (or next-error-verbose
(not (eq prev next-error-last-buffer)))
(message "%s locus from %s"
(cond (reset "First")
((eq (prefix-numeric-value arg) 0) "Current")
((< (prefix-numeric-value arg) 0) "Previous")
(t "Next"))
next-error-last-buffer)))))))