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

From: Troy Brown <[email-masked]>
Date: Mon, 14 Jul 2025 07:52:50 -0400

On Fri, Jul 11, 2025 at 2:49 AM Eli Zaretskii <[email-masked]> wrote:
>
> > From: Troy Brown <[email-masked]>
> > Date: Thu, 10 Jul 2025 21:26:30 -0400
> > Cc: Stefan Monnier <[email-masked]>, [email-masked]
> >
> > On Sat, Jul 5, 2025 at 3:59 AM Eli Zaretskii <[email-masked]> wrote:
> > >
> > > > From: Stefan Monnier <[email-masked]>
> > > > Cc: Eli Zaretskii <[email-masked]>,  [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.
> > >
> > > Ping!  Any further comments, or should I close this bug?
> >
> > I'd be fine if someone wanted to make it more general.  There are
> > actually multiple Ada major modes available.  The ada-mode in ELPA is
> > currently unmaintained, but there are at least 3 alternatives that I'm
> > aware of (including my own ada-ts-mode).  The ideal solution is likely
> > one where everyone can benefit, but barring someone wanting to drive
> > this to a generalized conclusion, I'm fine with a mode-specific
> > solution.
>
> To have this in the Ada modes out there, we need to bring the
> respective authors on board of this discussion.  Would someone like to
> do that, please?

Shouldn't this be an opt-in situation?  I suspect most alternative Ada
modes won't care about this.  How do you propose an unmaintained
ada-mode is addressed?  The original issue that caused this bug report
actually arose on the ada-mode-users mailing list since there was a
user attempting to use etags with ada-mode.  I was able to provide a
workaround for the user to address their needs.

The following are the major modes I'm aware of that support Ada:
- ada-mode (https://savannah.nongnu.org/projects/ada-mode/)
  - Available on ELPA and currently unmaintained.
- ada-ts-mode (https://github.com/brownts/ada-ts-mode)
  - Available on MELPA and Github, I am the author/maintainer.
  - I will be making the necessary changes to support etags.
- old-ada-mode (https://github.com/tkurtbond/old-ada-mode)
  - Available on Github.
  - This is the version of ada-mode which shipped with Emacs (until Emacs 27).
  - Some people prefer old-ada-mode over ada-mode due to the
complexity of installation of ELPA ada-mode.
  - It appears to be feature-locked and only incorporates bug fixes.
- ada-light-mode (https://github.com/sebastianpoeplau/ada-light-mode)
  - Available on Github.
  - Relies on Ada LSP for much of its capability, therefore I suspect
it's not interested in supporting etags.