; Improve documentation of commands that move by compilation errors

* lisp/simple.el (next-error):
* lisp/progmodes/compile.el (compilation-next-error)
(compilation-previous-error): Doc fixes.
This commit is contained in:
Eli Zaretskii 2026-05-17 09:05:13 +03:00
parent cf96e9cb5a
commit f68e7a0a41
2 changed files with 18 additions and 4 deletions

View file

@ -2821,13 +2821,23 @@ and runs `compilation-filter-hook'."
(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].
This function does NOT find the source line like \\[next-error],
but you can use \\[compilation-display-error] to find and
display the corresponding source code.
Prefix arg N says how many error messages to move forwards (or
backwards, if negative).
Where the current error ends and the next one begins is determined
by the rules from `compilation-error-regexp-alist' that matched
the compilation messages; this function moves point to where
the \\+`compilation-message' text property changes its value.
In general, all the messages that have the same line and column
numbers are considered parts of a single compilation message.
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."
looking for the next message.
In interacvtive invocations, DIFFERENT-FILE and PT are always nil."
(interactive "p")
(or (compilation-buffer-p (current-buffer))
(error "Not in a compilation buffer"))
@ -2871,7 +2881,8 @@ looking for the next message."
"Move point to the previous error in the compilation buffer.
Prefix arg N says how many error messages to move backwards (or
forwards, if negative).
Does NOT find the source line like \\[previous-error]."
Does NOT find the source line like \\[previous-error].
This is like `compilation-next-error', but moves in the other direction."
(interactive "p")
(compilation-next-error (- n)))

View file

@ -362,7 +362,10 @@ 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'."
`compilation-error-regexp-alist'. The rules there determine the
boundaries between error messages. In general, messages that share
the same line and column numbers are considered parts of a single
error message."
(interactive "P")
(if (consp arg) (setq reset t arg nil))
(let ((buffer (next-error-find-buffer)))