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

From: Ted Zlatanov <[email-masked]>
Date: Mon, 04 May 2015 18:33:56 -0400

On Tue, 5 May 2015 01:22:39 +0300 Dmitry Gutov <[email-masked]> wrote: 

DG> On 05/05/2015 01:03 AM, Ted Zlatanov wrote:
>> Then (1) can become "if one window on the selected frame has the highest
>> priority, return it."

DG> How will this help the user to control which error function to use next?

It doesn't help the user.  It helps mode writers give their modes the
appropriate priority so the user doesn't have to know.

DG> And why the windows on the selected frame? If *compile* is buried,
DG> does it become useless? I'd say the opposite.

Perhaps?  I am giving a suggestion, not a full implementation.  The
essential thing is that we rank buffers, not just pick "the last one" or
the "one visible with 5 hieroglyphs" or whatever other DWIMmery we
currently use.

DG> Or suppose I have 4 windows open in the frame, and each one's buffer
DG> has a next-error-function that refers only to positions in the current
DG> file? And there's a *compile* buffer buried somewhere. How do I
DG> actually use the current buffer's next-error-function, aside from C-x
DG> 1?

Some history: I actually, long ago when `next-error' turned into a
navigation facility, we[1] had the idea of "meta next-error" which would
navigate one level higher than local. That would have made this whole
discussion, including rankings by priority, moot by simply saying "to
navigate between files (compile, grep) you use `meta-next-error' or
whatever it's called. to navigate inside file locations, use
`next-error'."

I was supposed to write a patch after the release but... the dog ate my
TODO list.

Perhaps you are interested in adapting that code instead of hacking on
the current scheme?  Or should I retry implementing it?  9 years late is
not too bad, right? :)

If there's a time to implement this, I'd say it's now, before the 25.1
release, because it will break how many people expect `next-error' to
work.  But OTOH I think it will improve the UI.

Thanks
Ted

[1] Lars, me, and others: https://lists.gnu.org/archive/html/emacs-devel/2006-04/msg00488.html