Subject: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions doesn't find definitions

From: Stefan Monnier <[email-masked]>
Date: Tue, 24 Jun 2025 18:11:31 -0400

Hi Troy,

> For a mode-specific solution, I'm currently using the following.  It
> modifies the result of the completion table to remove the suffix, but
> stores the suffix as a text property on the candidate.  Then the text
> property is retrieved from within the annotation function to generate
> the appropriate suffix.  In this example, I chose to use a more
> descriptive suffix rather than reapplying the original one.  I'm also
> using the text property to drive additional "company-kind" information
> too.  This solution seems to be working well for me.

That seems like a much better solution than my exit-function, indeed.

I suggest adding it to `ada-mode` plus adding to `etag.el` a comment
pointing to that ada-mode` code.

The `etags.el` comment is because `etags.el` now has partial support for
those `/X` annotations.  This partial support is used only for Ada
currently, but the way it's implemented in `etags.el` it can be used for
any language, so it could make sense in the future to move your code
into `etags.el`.

Another option would be to put the code directly in `etags.el`, and make
it non-specific to Ada.  To reduce the cost of your wrapper, we could use
an `etags--found-slash-x-annotation` variable which is set whenever we
match the "/[...]" while reading the TAGS file, and then we only do the
extra dance when that var is non-nil.

        Stefan