previous-error

previous-error is an interactive compiled Lisp function in `simple.el'.

It is bound to M-g p, M-g M-p.

(previous-error &optional N)

Visit previous `next-error' message and corresponding source code.

Prefix arg N says how many error messages to move backwards (or
forwards, if negative).

This operates on the output from the M-x compile and M-x grep commands.