Subject: bug#20489: 25.0.50; next-error-find-buffer chooses non-current buffer without good reason

From: Juri Linkov <[email-masked]>
Date: Wed, 28 Feb 2018 23:32:52 +0200

>> This works well in most cases except the case of xref buffers.
>> Below is the explanation for code from next-error with added remarks:
>>
>> (defun next-error (&optional arg reset)
>>    (let ((buffer (next-error-find-buffer)))
>>      (when buffer
>>        (with-current-buffer buffer
>>
>> Here the current buffer is *xref*
>>
>>          (funcall next-error-function (prefix-numeric-value arg) reset)
>>
>> next-error-function should navigate from *xref* to another buffer
>> and change the current-buffer to the navigated buffer, e.g. ChangeLog.1.
>
> If that's something next-error-function must do, let's document it
> better. Right now it only says "Function to use to find the next error in
> the current buffer" (how does one "find" an error?) and describes input
> arguments, but not the return value (which is luckily unused) or which
> buffer must be current, or which window selected at the end.

It's not yet clear which window should be selected at the end,
please see the recent bug#30646.