Subject: bug#2544: 23.0.60; Could etags please try find a local tag first?

From: Eli Zaretskii <[email-masked]>
Date: Mon, 19 Jul 2021 18:56:22 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Date: Mon, 19 Jul 2021 16:48:52 +0200
> Cc: [email-masked]
> 
> Matzi Kratzi <[email-masked]> writes:
> 
> > Would it make sense, in general, for etags to first try to find a tag
> > inside the current buffer? I am working in legacy code that has the
> > same name for certain help functions in many files. I would like etags
> > to first try find the tag inside the current buffer.
> 
> (I'm going through old bug reports that unfortunately got no response at
> the time.)
> 
> I can certainly see cases where that would be useful.  I think much of
> this stuff has been rewritten in terms of xref now?  I gave the xref
> code a quick look-over, but I didn't see anything obvious in this
> area...
> 
> Does anybody know whether Emacs grown support for this use case in the
> 12 years since this bug report was filed?

We did switch to Xref, but for many languages (including C), Xref
still uses etags as its back-end.  So etags is still relevant.

As for the original request: I guess we could satisfy that by having
Xref sort the matches so that those in the current buffer come first
in the display we show in the *XREF* buffer?  Dmitry, would it make
sense to add such an option, and if so, would it be hard to do so?  In
xref--alistify, perhaps, or in xref--analyze?