Variable: next-error-last-buffer

The most recent `next-error' buffer.
A buffer becomes most recent when its compilation, grep, or
similar mode is started, or when it is used with C-x `
or M-x compile-goto-error.