GNU bug report logs - #78489
30.1.50; Using etags, Ada and xref-find-definitions doesn't find definitions

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Troy Brown <brownts@HIDDEN>; dated Mon, 19 May 2025 01:39:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 15:30:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 27 11:30:05 2025
Received: from localhost ([127.0.0.1]:42606 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJwFg-0008RL-4d
	for submit <at> debbugs.gnu.org; Tue, 27 May 2025 11:30:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38226)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uJwFc-0008M5-Rl
 for 78489 <at> debbugs.gnu.org; Tue, 27 May 2025 11:30:02 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uJwFV-0001PK-0j; Tue, 27 May 2025 11:29:53 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=BFV41SlaT8+F/raQd2Sssmu2nnfM1qTQEOaOa3tmCHQ=; b=JoOXuPut4T6k
 CeR1X1ozlYDWDuuCOHUwxxzI0uDjJgw9RHKmc4f+o4K+XPPEKeTwUWUTFUcDG6bbG1D03LkUJgcZQ
 vLeEcYLCKsWADySTtLeFXDC0Qnm2lcddvScRoV/OcHj/3omeArCutoELxQqZhni9Q2mPKc+6JIqjd
 Cp0EzeNIZYMqbYCJ7uokKPxi9WEja29Kyyy6DT4pMN3OdJimsT7NaFg9IzqS3PBFCUdviUZ4JmS3Y
 IYFcs+5L0yyjbQBqZZby6kF7PXzkzRg2qeWY52xmsVAU1FMTTrz82/Km3gnpj/FV4Bjc4HyTVSt9P
 tfGXOrgKW6tonUlB/SHlAQ==;
Date: Tue, 27 May 2025 18:29:46 +0300
Message-Id: <868qmixead.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <jwvplfunooq.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Tue, 27 May 2025 10:00:29 -0400)
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 <86msayxqx0.fsf@HIDDEN>
 <CABvCZ40nOp-N8RBPy=YUBh_7tNVpbBKFRXWDddrjjOSs5NCqNw@HIDDEN>
 <86bjrexmzj.fsf@HIDDEN> <jwvplfunooq.fsf-monnier+emacs@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: brownts@HIDDEN, 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: Troy Brown <brownts@HIDDEN>,  78489 <at> debbugs.gnu.org
> Date: Tue, 27 May 2025 10:00:29 -0400
> 
> I haven't had time to look closely, but IIUC those `/p` aren't
> reallypart of the completed names but only some meta-info about their
> nature, so it sounds like a job for `:annotation-function` (in
> `completion-at-point-function`) or `annotation-function` (in the
> completion table's metadata).

I'm not sure I follow: if you say that annotation-function should add
those "/p" qualifiers, then that's not really possible, since they are
appended by etags and are present in the TAGS file.  Ada tags always
worked like that, for some reason I cannot understand, but we cannot
easily change this now.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 14:00:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 27 10:00:41 2025
Received: from localhost ([127.0.0.1]:41953 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJurB-0001lS-EV
	for submit <at> debbugs.gnu.org; Tue, 27 May 2025 10:00:41 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34606)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1uJur7-0001l3-86
 for 78489 <at> debbugs.gnu.org; Tue, 27 May 2025 10:00:38 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BD632808B5;
 Tue, 27 May 2025 10:00:31 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1748354430;
 bh=+FPM3wY+yb40066bvinkW+1HsRMFg5K4gNNsjlxgxrA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=j7YiJg4YBPVzGBB/jyyOqb30rBRyLqQB3k+0U4JSMSe6nfH9PV2xxzQIif9Gmzc8i
 OwrJLf8mdvM0TiFHoEzv3dEMh8zfN87wiWlW2Emdu/7fGvAQlDZ4KNBpCzqnihpeqg
 pAmjNrSt8VxKiFtDAQja/yDf/+QdCXk3NRrPTMN7ADkBQZC+DTAyWZOsNkEN/IYWnp
 5RNShP0kwTfdPzLu2E9a6vrGVIEKoc32BLMA9tL/1vCwiGEwg6Uie5lMcAYkPMtwKl
 RbFHC9gO8SgkTnn5u0Duf7S5BXkL8w4WQanu9DhK4S0BYHoUFQOGCdr/ql5ugxHB74
 PndSyAabdrAxw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D120B801F6;
 Tue, 27 May 2025 10:00:30 -0400 (EDT)
Received: from pastel (unknown [104.247.225.139])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7FC961203A5;
 Tue, 27 May 2025 10:00:30 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
In-Reply-To: <86bjrexmzj.fsf@HIDDEN>
Message-ID: <jwvplfunooq.fsf-monnier+emacs@HIDDEN>
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 <86msayxqx0.fsf@HIDDEN>
 <CABvCZ40nOp-N8RBPy=YUBh_7tNVpbBKFRXWDddrjjOSs5NCqNw@HIDDEN>
 <86bjrexmzj.fsf@HIDDEN>
Date: Tue, 27 May 2025 10:00:29 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.377 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: Troy Brown <brownts@HIDDEN>, 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> procedure Hello_World is
>>    procedure Display_Message is
>>    begin
>>       Put_Line ("Hello, World!");
>>    end Display_Message;
>> begin  -- Hello_World
>>    Display_Message/p
>> end Hello_World;
>> --8<---------------cut here---------------end--------------->8---
>> 
>> As you can see above the "/p" suffix is added into the buffer as part
>> of the completion.  This is not valid syntax.  I must therefore delete
>> "/p" before adding the final semicolon.  This is what my suggested fix
>> was attempting to address...preventing the insertion of the invalid
>> suffix into the buffer.
>
> "M-x completion-at-point" is a separate command, so this is basically
> a separate issue, unrelated to our switch to Xref.  Trying this
> command in Emacs 24.4, I see that it inserts "Display_Message/p" in
> that version as well.  While I agree with you that it isn't
> user-friendly to insert the "/p" part, I'm not sure the fix should be
> in etags-tags-completion-table, because that function is called (via
> tags-completion-table-function) in more than just this scenario, and
> we could break some of those other scenarios.
>
> Maybe Ada source files should have their own specialized value for
> completion-at-point-functions?
>
> Stefan, WDYT?

I haven't had time to look closely, but IIUC those `/p` aren't
reallypart of the completed names but only some meta-info about their
nature, so it sounds like a job for `:annotation-function` (in
`completion-at-point-function`) or `annotation-function` (in the
completion table's metadata).


        Sefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 12:22:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 27 08:22:12 2025
Received: from localhost ([127.0.0.1]:39775 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJtJs-0002gT-4l
	for submit <at> debbugs.gnu.org; Tue, 27 May 2025 08:22:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43460)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uJtJo-0002fv-Ll
 for 78489 <at> debbugs.gnu.org; Tue, 27 May 2025 08:22:09 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uJtJe-0008Fx-Hl; Tue, 27 May 2025 08:21:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=vxt9/Iz4uOJsuRUNDIAO7cUzX/ENNFeZg+rs706q4uk=; b=BjeIF2euHEPEJhm9rfRN
 M62+OI9FMWUf88GjljLP6ATMMAaIVzGPV/qokqQy41XqFBonlu0F9ucgJyvw0rzyqy+cXX75Gqb00
 G8u8ZpmuSkPKMDYIHsLgcWRIfTZoqhhT5B0dtkfSOjW608hBrMK9NzO1KUDYSqeV8Q4A7T02NTNFY
 mvUqDaKPeaAudM9KVTFkcW3yu0sHIWS2FMs5j83UVJq8pr5MhjseMa3NgHrRxl4QhWEchEuBH4gRq
 ZtZfhyEzf7VtSM+2Zop9uCEpAwjGBHc1T1aqLptUtOWpo6k6E35n7k2ffMWTsQOk+BbNxpyALqciV
 VRMqVwlLbytBlA==;
Date: Tue, 27 May 2025 15:21:52 +0300
Message-Id: <86bjrexmzj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Troy Brown <brownts@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CABvCZ40nOp-N8RBPy=YUBh_7tNVpbBKFRXWDddrjjOSs5NCqNw@HIDDEN>
 (message from Troy Brown on Tue, 27 May 2025 07:43:33 -0400)
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 <86msayxqx0.fsf@HIDDEN>
 <CABvCZ40nOp-N8RBPy=YUBh_7tNVpbBKFRXWDddrjjOSs5NCqNw@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Troy Brown <brownts@HIDDEN>
> Date: Tue, 27 May 2025 07:43:33 -0400
> Cc: 78489 <at> debbugs.gnu.org
> 
> On Tue, May 27, 2025 at 6:57 AM Eli Zaretskii <eliz@HIDDEN> wrote:
> >
> > No, the user doesn't need to delete the "/p" part, Emacs will find the
> > tag whether it does or doesn't and in "/p".  You can try that with my
> > patch, it works.
> 
> I did try it with the patch, but I'm still seeing an issue (with
> completion).  That's why I don't think the patch fixes everything,
> just navigation.

It fixes Xref and M-. command, with or without TAB-completion of
candidates.  That was the regression you reported in your original
report.

> > > Did you see the previous response I sent?  I think our responses may
> > > have occurred around the same time.  I found a place to correct that
> > > behavior in `etags-tags-completion-table` which is a regex fixup
> > > similar to the first one.
> >
> > Thanks, but I don't think we should make such a change, because users
> > might actually expect to see the "/p" and other qualifiers in the
> > completion candidates, since that's how Ada tags worked before we
> > switched to Xref.
> >
> > IOW, those "/x" qualifiers of the Ada tags are a user-facing feature,
> > so any changes in it will be noticed by users.  I think we should
> > preserve the original behavior, however weird it looks.
> 
> I would be fine if the suffix appeared in the completion candidates
> list, just not inserted in the buffer once a candidate is selected.
> 
> I think I'm not explaining the situation clearly.  The completion
> issue isn't whether it finds a candidate, the issue is what is
> inserted into the buffer once the candidate has been selected...or
> when there is only a single candidate and the completion is
> automatically inserted without displaying the "*Completions*" buffer.
> I'd be fine if the completion buffer displayed the suffix, as long as
> it wasn't inserted into the buffer.
> 
> I'll try with an example, as I think that demonstrates the problem.
> This assumes the same setup as was documented in the original email
> bug report, with the following in the buffer (notice the "Disp"
> partial on line 9).  This also includes your previously suggested fix,
> but without my suggested additional fix.
> 
> --8<---------------cut here---------------start------------->8---
> with Ada.Text_IO; use Ada.Text_IO;
> 
> procedure Hello_World is
>    procedure Display_Message is
>    begin
>       Put_Line ("Hello, World!");
>    end Display_Message;
> begin  -- Hello_World
>    Disp
> end Hello_World;
> --8<---------------cut here---------------end--------------->8---
> 
> Assuming point is after "Disp" on line 9, I perform `M-x
> completion-at-point`.  In this example, there is only a single
> completion for this prefix in the TAGS file, thus it is automatically
> completed in the file buffer without displaying the *Completions*
> buffer.  After the completion, the buffer contents look like the
> following:
> 
> --8<---------------cut here---------------start------------->8---
> with Ada.Text_IO; use Ada.Text_IO;
> 
> procedure Hello_World is
>    procedure Display_Message is
>    begin
>       Put_Line ("Hello, World!");
>    end Display_Message;
> begin  -- Hello_World
>    Display_Message/p
> end Hello_World;
> --8<---------------cut here---------------end--------------->8---
> 
> As you can see above the "/p" suffix is added into the buffer as part
> of the completion.  This is not valid syntax.  I must therefore delete
> "/p" before adding the final semicolon.  This is what my suggested fix
> was attempting to address...preventing the insertion of the invalid
> suffix into the buffer.

"M-x completion-at-point" is a separate command, so this is basically
a separate issue, unrelated to our switch to Xref.  Trying this
command in Emacs 24.4, I see that it inserts "Display_Message/p" in
that version as well.  While I agree with you that it isn't
user-friendly to insert the "/p" part, I'm not sure the fix should be
in etags-tags-completion-table, because that function is called (via
tags-completion-table-function) in more than just this scenario, and
we could break some of those other scenarios.

Maybe Ada source files should have their own specialized value for
completion-at-point-functions?

Stefan, WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 11:44:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 27 07:44:03 2025
Received: from localhost ([127.0.0.1]:39489 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJsiw-0008J3-0z
	for submit <at> debbugs.gnu.org; Tue, 27 May 2025 07:44:02 -0400
Received: from m228-15.mailgun.net ([159.135.228.15]:34774)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2)
 (envelope-from <bounce+229f5e.5fd5d2-78489=debbugs.gnu.org@HIDDEN>)
 id 1uJsis-0008I7-N1
 for 78489 <at> debbugs.gnu.org; Tue, 27 May 2025 07:44:00 -0400
DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.troybrown.dev;
 q=dns/txt; s=mx; t=1748346225; x=1748353425; 
 h=Content-Transfer-Encoding: Content-Type: Cc: To: To: Subject: Subject:
 Message-ID: Date: From: From: In-Reply-To: References: MIME-Version: Sender:
 Sender; bh=gUgRE3b72NdAAxbzrau3Y9hkzEwrKVo1GRnPxKyBpFY=;
 b=BAae/6OMjXrjEZi8E+w8+6Y3Xqos/zyc9JkSEsvbKuCp+h0OrPYLyaT4izU+lvZkuGztiGjEZHHmbFvtWXHxP71XLUt4FvM2ylgdLJz3XS1z5F7r9hfF9mAaRCuKH4MW6yXTtEVaic0VVovF/ZD2OMdKdIUETTarQmmRLojdBqE=
X-Mailgun-Sid: WyJiOTYxMCIsIjc4NDg5QGRlYmJ1Z3MuZ251Lm9yZyIsIjVmZDVkMiJd
Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com
 [209.85.208.54]) by
 6618b4fe455a with SMTP id 6835a571103a6517253e40c2 (version=TLS1.3,
 cipher=TLS_AES_128_GCM_SHA256); Tue, 27 May 2025 11:43:45 GMT
X-Mailgun-Sending-Ip-Pool-Name: 
X-Mailgun-Sending-Ip-Pool: 
X-Mailgun-Sending-Ip: 159.135.228.15
Received: by mail-ed1-f54.google.com with SMTP id
 4fb4d7f45d1cf-603fdd728ccso4694824a12.2
 for <78489 <at> debbugs.gnu.org>; Tue, 27 May 2025 04:43:45 -0700 (PDT)
X-Gm-Message-State: AOJu0Yxh6m2GxpM5EGhrP6S4xvLgxXiJOoKuULoRo66Qin2nLanVeYoy
 bxg4T7RIggqUefUj2yVyQFuMJNr4312Tu9PMaSZR2uRpp+laommjkAl3R+cdaoRDxEpMXi+B7p9
 xnjDJmOWeDy9B4Ai/ubhkk9k50aMtNiU=
X-Google-Smtp-Source: AGHT+IHGOmVpVkuJk4CmzsLFe0W/71vitBcRxzywMkJmxZ2G+rvILKQuOlvXudadMVCXbQcLqLhGftLsYVKUDsF0otI=
X-Received: by 2002:a05:6402:1d55:b0:5f4:d4a7:dab1 with SMTP id
 4fb4d7f45d1cf-602d9cf2857mr10454778a12.18.1748346224556; Tue, 27 May 2025
 04:43:44 -0700 (PDT)
MIME-Version: 1.0
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 <86msayxqx0.fsf@HIDDEN>
In-Reply-To: <86msayxqx0.fsf@HIDDEN>
From: Troy Brown <brownts@HIDDEN>
Date: Tue, 27 May 2025 07:43:33 -0400
X-Gmail-Original-Message-ID: <CABvCZ40nOp-N8RBPy=YUBh_7tNVpbBKFRXWDddrjjOSs5NCqNw@HIDDEN>
X-Gm-Features: AX0GCFsAukA9i-9YFDuA9A7M-mM1FwZPEEDNPMUkle1S2hNl_cIC3GE-c_gczgA
Message-ID: <CABvCZ40nOp-N8RBPy=YUBh_7tNVpbBKFRXWDddrjjOSs5NCqNw@HIDDEN>
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue, May 27, 2025 at 6:57=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote:
>
> > In the testing I've done, this patch works correctly and addresses the
> > original problem reported.
>
> Thanks, I've now installed the fix on the master branch.

Thank you.

> > > > However, as I explored this a bit further
> > > > I discovered another issue that involves completion.  After typing
> > > > 'Displ' and then `M-x completion-at-point`, the tag including the
> > > > suffix is completed (i.e., "Display_Message/p" is inserted into the
> > > > buffer, instead of just "Display_Message").
> > >
> > > That's how completion on Ada tags worked back when we used etags.el
> > > instead of Xref, so I consider this not to be a regression.  If you
> > > think otherwise, please explain why, or show a recipe which behaves
> > > differently in Emacs 24 and before.
> >
> > Really?  So the user would complete and then have to delete the last
> > two characters of the completion in their buffer to remove the suffix?
>
> No, the user doesn't need to delete the "/p" part, Emacs will find the
> tag whether it does or doesn't and in "/p".  You can try that with my
> patch, it works.

I did try it with the patch, but I'm still seeing an issue (with
completion).  That's why I don't think the patch fixes everything,
just navigation.

> > Did you see the previous response I sent?  I think our responses may
> > have occurred around the same time.  I found a place to correct that
> > behavior in `etags-tags-completion-table` which is a regex fixup
> > similar to the first one.
>
> Thanks, but I don't think we should make such a change, because users
> might actually expect to see the "/p" and other qualifiers in the
> completion candidates, since that's how Ada tags worked before we
> switched to Xref.
>
> IOW, those "/x" qualifiers of the Ada tags are a user-facing feature,
> so any changes in it will be noticed by users.  I think we should
> preserve the original behavior, however weird it looks.

I would be fine if the suffix appeared in the completion candidates
list, just not inserted in the buffer once a candidate is selected.

I think I'm not explaining the situation clearly.  The completion
issue isn't whether it finds a candidate, the issue is what is
inserted into the buffer once the candidate has been selected...or
when there is only a single candidate and the completion is
automatically inserted without displaying the "*Completions*" buffer.
I'd be fine if the completion buffer displayed the suffix, as long as
it wasn't inserted into the buffer.

I'll try with an example, as I think that demonstrates the problem.
This assumes the same setup as was documented in the original email
bug report, with the following in the buffer (notice the "Disp"
partial on line 9).  This also includes your previously suggested fix,
but without my suggested additional fix.

--8<---------------cut here---------------start------------->8---
with Ada.Text_IO; use Ada.Text_IO;

procedure Hello_World is
   procedure Display_Message is
   begin
      Put_Line ("Hello, World!");
   end Display_Message;
begin  -- Hello_World
   Disp
end Hello_World;
--8<---------------cut here---------------end--------------->8---

Assuming point is after "Disp" on line 9, I perform `M-x
completion-at-point`.  In this example, there is only a single
completion for this prefix in the TAGS file, thus it is automatically
completed in the file buffer without displaying the *Completions*
buffer.  After the completion, the buffer contents look like the
following:

--8<---------------cut here---------------start------------->8---
with Ada.Text_IO; use Ada.Text_IO;

procedure Hello_World is
   procedure Display_Message is
   begin
      Put_Line ("Hello, World!");
   end Display_Message;
begin  -- Hello_World
   Display_Message/p
end Hello_World;
--8<---------------cut here---------------end--------------->8---

As you can see above the "/p" suffix is added into the buffer as part
of the completion.  This is not valid syntax.  I must therefore delete
"/p" before adding the final semicolon.  This is what my suggested fix
was attempting to address...preventing the insertion of the invalid
suffix into the buffer.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 10:57:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 27 06:57:12 2025
Received: from localhost ([127.0.0.1]:39162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJrzb-0001zw-HY
	for submit <at> debbugs.gnu.org; Tue, 27 May 2025 06:57:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41172)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uJrzZ-0001zI-35
 for 78489 <at> debbugs.gnu.org; Tue, 27 May 2025 06:57:09 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uJrzT-0004iE-Bv; Tue, 27 May 2025 06:57:03 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=I4fnOJ7eBWej7GRjL48VEdiRL2ZuDGyuWXu30V6rXd0=; b=LZsAMba2af26wJG0S6bb
 5+M3vRrYTv5kPz2do70xk0MLQy7fhGT19BJt2sBE8FCGXZvPJwzkVCwfPtQyPylf7kepgazPa7FXE
 SEs+eqYjmOedyJ3SrCiFGSlxWRUKGCj9C9WRsyG2R7mm/vqkr5BhRXOft5UBgoDcgVo10kQbqIeA6
 oEE/hvN5DGTOV9+kEmeyCNTJYA8WWjfyB6P20y9IKfOXHXxxV/SMYZpy6ZWaX81c2j+lWrbmZL4+P
 r4K0lSzaJ1cbp7Ub3CfSbcZERUFpN4wmCZHfyMYUjzdsSNygtzCAzXqZP4BaLFvpa9V6XgfYpYmvY
 clTXVHmmwAWcPQ==;
Date: Tue, 27 May 2025 13:56:59 +0300
Message-Id: <86msayxqx0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Troy Brown <brownts@HIDDEN>
In-Reply-To: <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 (message from Troy Brown on Mon, 26 May 2025 16:13:19 -0400)
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Troy Brown <brownts@HIDDEN>
> Date: Mon, 26 May 2025 16:13:19 -0400
> Cc: 78489 <at> debbugs.gnu.org
> 
> On Thu, May 22, 2025 at 7:31 AM Eli Zaretskii <eliz@HIDDEN> wrote:
> >
> > Thanks for the analysis.  Out of curiosity: do you happen to know the
> > reasons why Ada tags have these suffixes?  It seems to be Ada-only
> > feature, so I wonder what's it about?
> 
> The creation of the Ada TAGS support in Emacs predates my involvement,
> so unfortunately, I don't know the reasoning behind it, other than
> what appears in the manual (wanting to differentiate between symbols
> of the same name in different contents).  However, that wouldn't be
> unique to Ada.
> 
> > I can propose the patch below instead.  Could you please see if it
> > solves your problems with Ada tags?
> 
> In the testing I've done, this patch works correctly and addresses the
> original problem reported.

Thanks, I've now installed the fix on the master branch.

> > > However, as I explored this a bit further
> > > I discovered another issue that involves completion.  After typing
> > > 'Displ' and then `M-x completion-at-point`, the tag including the
> > > suffix is completed (i.e., "Display_Message/p" is inserted into the
> > > buffer, instead of just "Display_Message").
> >
> > That's how completion on Ada tags worked back when we used etags.el
> > instead of Xref, so I consider this not to be a regression.  If you
> > think otherwise, please explain why, or show a recipe which behaves
> > differently in Emacs 24 and before.
> 
> Really?  So the user would complete and then have to delete the last
> two characters of the completion in their buffer to remove the suffix?

No, the user doesn't need to delete the "/p" part, Emacs will find the
tag whether it does or doesn't and in "/p".  You can try that with my
patch, it works.

>  I'll take your word for it, that it operated that way, as I don't
> think I have access to an Emacs 24 that I could test that with, but
> that sounds broken...what's the point of completion if the inserted
> text needs to be fixed up in the buffer afterwards?

As I said, there's no need to fix the completion.  In addition, these
qualifiers are documented in the "etags --help --language=ada" output,
so they are known to users.

> Did you see the previous response I sent?  I think our responses may
> have occurred around the same time.  I found a place to correct that
> behavior in `etags-tags-completion-table` which is a regex fixup
> similar to the first one.

Thanks, but I don't think we should make such a change, because users
might actually expect to see the "/p" and other qualifiers in the
completion candidates, since that's how Ada tags worked before we
switched to Xref.

IOW, those "/x" qualifiers of the Ada tags are a user-facing feature,
so any changes in it will be noticed by users.  I think we should
preserve the original behavior, however weird it looks.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 03:16:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 26 23:16:23 2025
Received: from localhost ([127.0.0.1]:35190 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJknf-0005M3-1N
	for submit <at> debbugs.gnu.org; Mon, 26 May 2025 23:16:23 -0400
Received: from m228-15.mailgun.net ([159.135.228.15]:43164)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2)
 (envelope-from <bounce+229f5e.5fd5d2-78489=debbugs.gnu.org@HIDDEN>)
 id 1uJknc-0005LT-PP
 for 78489 <at> debbugs.gnu.org; Mon, 26 May 2025 23:16:21 -0400
DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.troybrown.dev;
 q=dns/txt; s=mx; t=1748315769; x=1748322969; 
 h=Content-Transfer-Encoding: Content-Type: Cc: To: To: Subject: Subject:
 Message-ID: Date: From: From: In-Reply-To: References: MIME-Version: Sender:
 Sender; bh=/Vv7uQ82W7eaO4HYP4YMNiWQi6g44E0xjvgvcdsyLAk=;
 b=lMq1yrsZZDZL4EzLNkDO0dzOoSOv+ta1k41zBsW09HPhmEnQPmE0P+DsGpMxUZdzUwgetP6nsrFZIJWmaLQb6GNl5eD0hL4UBNXCj8FUhL7BlNlBeP9yWao1qK6qxqBfSv1bhfl2qItIZVf6L2NlwQ0XS+ua6cbslzYh5jwF5ek=
X-Mailgun-Sid: WyJiOTYxMCIsIjc4NDg5QGRlYmJ1Z3MuZ251Lm9yZyIsIjVmZDVkMiJd
Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com
 [209.85.218.43]) by
 b937afeedd9e with SMTP id 68352e79c8ee7f70986d6235 (version=TLS1.3,
 cipher=TLS_AES_128_GCM_SHA256); Tue, 27 May 2025 03:16:09 GMT
X-Mailgun-Sending-Ip-Pool-Name: 
X-Mailgun-Sending-Ip-Pool: 
X-Mailgun-Sending-Ip: 159.135.228.15
Received: by mail-ej1-f43.google.com with SMTP id
 a640c23a62f3a-ac34257295dso565615666b.2
 for <78489 <at> debbugs.gnu.org>; Mon, 26 May 2025 20:16:09 -0700 (PDT)
X-Gm-Message-State: AOJu0YxZYD2EaL3X9axV8ux8x5cf4lVeDbIb3ZmdZx663eoDaT3ahtq0
 ebLVOjoKOh/kDJFUdm6zqGXobighF2hy0V8GSP95Q+rrMjNVTEh0LtyV7xnTskwHSLF0HYZnlVW
 g84pSJZ1t0zcahm7WGVGThKJGcWoZ8pg=
X-Google-Smtp-Source: AGHT+IGTZytduVnLsH9os/bMS8rdKYAikBPmzv6xFdXgkbBGzZNQKL+B/1fobsWVHyaZ2hk4l/fqpbKr/U/KWSXKpGQ=
X-Received: by 2002:a17:907:86a7:b0:ad2:409f:fe6f with SMTP id
 a640c23a62f3a-ad85b2c684amr920797266b.44.1748315768121; Mon, 26 May 2025
 20:16:08 -0700 (PDT)
MIME-Version: 1.0
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 <86o6veye8a.fsf@HIDDEN>
In-Reply-To: <86o6veye8a.fsf@HIDDEN>
From: Troy Brown <brownts@HIDDEN>
Date: Mon, 26 May 2025 23:15:57 -0400
X-Gmail-Original-Message-ID: <CABvCZ40y66sCiP0M07xb0Jq_+pPGBZrLw9wPs20+axuNuwXPfg@HIDDEN>
X-Gm-Features: AX0GCFv6q0F4bZgNUKdOvyFNo2OEQ3N4EGi4Ja9UQ-usufS0VNvL5IlpC4hWxVI
Message-ID: <CABvCZ40y66sCiP0M07xb0Jq_+pPGBZrLw9wPs20+axuNuwXPfg@HIDDEN>
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Mon, May 26, 2025 at 10:33=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wrote=
:
>
> > In the testing I've done, this patch works correctly and addresses the
> > original problem reported.  However, as I explored this a bit further
> > I discovered another issue that involves completion.  After typing
> > 'Displ' and then `M-x completion-at-point`, the tag including the
> > suffix is completed (i.e., "Display_Message/p" is inserted into the
> > buffer, instead of just "Display_Message").
>
> That's how completion on Ada tags worked back when we used etags.el
> instead of Xref, so I consider this not to be a regression.  If you
> think otherwise, please explain why, or show a recipe which behaves
> differently in Emacs 24 and before.

Really?  So the user would complete and then have to delete the last
two characters of the completion in their buffer to remove the suffix?
 I'll take your word for it, that it operated that way, as I don't
think I have access to an Emacs 24 that I could test that with, but
that sounds broken...what's the point of completion if the inserted
text needs to be fixed up in the buffer afterwards?

Did you see the previous response I sent?  I think our responses may
have occurred around the same time.  I found a place to correct that
behavior in `etags-tags-completion-table` which is a regex fixup
similar to the first one.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 02:33:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 26 22:33:37 2025
Received: from localhost ([127.0.0.1]:34913 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJk8G-0002J6-Tn
	for submit <at> debbugs.gnu.org; Mon, 26 May 2025 22:33:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47636)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uJk8D-0002Ie-TE
 for 78489 <at> debbugs.gnu.org; Mon, 26 May 2025 22:33:34 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uJk88-0007lp-C0; Mon, 26 May 2025 22:33:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=P4zb4yp94TkKNKLDki81cvbBro/BryCWFWf2UEEjrTM=; b=L4fqoSKtlraJKXcgP/L4
 mzFcL4DKkXfa5sCnHlmmZiwgLqUwyIlBnpzLxbW24weG8T152Fn40PIbaa1j5W3YbRkIKNG3oHAad
 f+YQoMDPaND5CXSjMS5q/RqPbOnZBDvZD8SDOsqYzXlduC4m+sS1HCg4S6ZGKUaFTNFuSU0GAddXy
 JjGa6czFp+q+CDmHwGt6woBQjgCgLsl/cjLaZYQG98Y1AN8xq6IU+eKA2bcizQM7UcL7zyzFHOwIg
 Jw+zsKeOJc1XwS0hKjpxg2dFueKeOCVG9JPkQ8ho+ZT4wCqGtFf6WU06eElna7GiyL1A33uGa3j1f
 0h4ga0G6MzPTdA==;
Date: Tue, 27 May 2025 05:33:25 +0300
Message-Id: <86o6veye8a.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Troy Brown <brownts@HIDDEN>
In-Reply-To: <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
 (message from Troy Brown on Mon, 26 May 2025 16:13:19 -0400)
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Troy Brown <brownts@HIDDEN>
> Date: Mon, 26 May 2025 16:13:19 -0400
> Cc: 78489 <at> debbugs.gnu.org
> 
> On Thu, May 22, 2025 at 7:31 AM Eli Zaretskii <eliz@HIDDEN> wrote:
> >
> > I can propose the patch below instead.  Could you please see if it
> > solves your problems with Ada tags?
> 
> In the testing I've done, this patch works correctly and addresses the
> original problem reported.  However, as I explored this a bit further
> I discovered another issue that involves completion.  After typing
> 'Displ' and then `M-x completion-at-point`, the tag including the
> suffix is completed (i.e., "Display_Message/p" is inserted into the
> buffer, instead of just "Display_Message").

That's how completion on Ada tags worked back when we used etags.el
instead of Xref, so I consider this not to be a regression.  If you
think otherwise, please explain why, or show a recipe which behaves
differently in Emacs 24 and before.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 27 May 2025 02:28:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 26 22:28:50 2025
Received: from localhost ([127.0.0.1]:34880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJk3d-0001wX-S2
	for submit <at> debbugs.gnu.org; Mon, 26 May 2025 22:28:50 -0400
Received: from m228-14.mailgun.net ([159.135.228.14]:47848)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2)
 (envelope-from <bounce+229f5e.5fd5d2-78489=debbugs.gnu.org@HIDDEN>)
 id 1uJk3b-0001wC-6V
 for 78489 <at> debbugs.gnu.org; Mon, 26 May 2025 22:28:47 -0400
DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.troybrown.dev;
 q=dns/txt; s=mx; t=1748312914; x=1748320114; 
 h=Content-Transfer-Encoding: Content-Type: Cc: To: To: Subject: Subject:
 Message-ID: Date: From: From: In-Reply-To: References: MIME-Version: Sender:
 Sender; bh=6WJpuuCenAHvdPqK4eLl8uvAP3XHhL0wdg48X8MIhyE=;
 b=dNqisxQih5PiLJWpG3pW8olFCAWnNjYFNY6PQ1PFamDejSCB8vDXKSqhfGDvtg/EURqHvW38hJRHbzuL6hluLXx4T9ATcBmvWJf0JfsTOwCer+Qawns6ihejgW5Jhvuej0degHzCNwfE97Y0qa+ZGluGWl22GoxYGJyJNlCtWl4=
X-Mailgun-Sid: WyJiOTYxMCIsIjc4NDg5QGRlYmJ1Z3MuZ251Lm9yZyIsIjVmZDVkMiJd
Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com
 [209.85.208.50]) by
 e43cea95fef7 with SMTP id 68352352c953711e148a3a8e (version=TLS1.3,
 cipher=TLS_AES_128_GCM_SHA256); Tue, 27 May 2025 02:28:34 GMT
X-Mailgun-Sending-Ip-Pool-Name: 
X-Mailgun-Sending-Ip-Pool: 
X-Mailgun-Sending-Ip: 159.135.228.14
Received: by mail-ed1-f50.google.com with SMTP id
 4fb4d7f45d1cf-6020ff8d54bso4556650a12.2
 for <78489 <at> debbugs.gnu.org>; Mon, 26 May 2025 19:28:34 -0700 (PDT)
X-Gm-Message-State: AOJu0YwnMXKKRdnoCfKxvFzuAIM0HqGz/Jbi7qydfFYozLI6g99vvv9n
 zsiYMr/w/iavdk9EpKALd2ZKzkekTfBOWwb/9DYOa89s0grN5xxNyZl4pRxUUaXHrIyqNA/2IHp
 PdvdTXU0lfigBqzEENsVY9XadIa6rAgI=
X-Google-Smtp-Source: AGHT+IE9zyJjcU6JU/i5iVRdxns13a6a/UZI6YwFYz9ui9gOXtQDVqETKHOnh4UaDeRmEVkOYlRT/UQUdYLkHyoYlrA=
X-Received: by 2002:a17:906:15d7:b0:ad8:728b:9ffe with SMTP id
 a640c23a62f3a-ad8728ba154mr492961066b.38.1748312913435; Mon, 26 May 2025
 19:28:33 -0700 (PDT)
MIME-Version: 1.0
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
 <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
In-Reply-To: <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
From: Troy Brown <brownts@HIDDEN>
Date: Mon, 26 May 2025 22:28:22 -0400
X-Gmail-Original-Message-ID: <CABvCZ42cHoeWnKqoOVxUaoXPbTEEPV6kaON1OnA=LX5rGamzqw@HIDDEN>
X-Gm-Features: AX0GCFs3dpYV_x7SczgTP2s1RltBjG1PFR8YjNtYgUuADPZYt5rzPnjpIeKMjs4
Message-ID: <CABvCZ42cHoeWnKqoOVxUaoXPbTEEPV6kaON1OnA=LX5rGamzqw@HIDDEN>
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Mon, May 26, 2025 at 4:13=E2=80=AFPM Troy Brown <brownts@HIDDEN> =
wrote:
>
> In the testing I've done, this patch works correctly and addresses the
> original problem reported.  However, as I explored this a bit further
> I discovered another issue that involves completion.  After typing
> 'Displ' and then `M-x completion-at-point`, the tag including the
> suffix is completed (i.e., "Display_Message/p" is inserted into the
> buffer, instead of just "Display_Message").

I found a spot in `etags-tags-completion-table` that needed
adjustment.  After this fix, the completion works as expected too.

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 352356ddbc5..41b61dc0763 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1288,7 +1288,7 @@ etags-tags-completion-table
       ;; This regexp matches an explicit tag name or the place where
       ;; it would start.
       (while (re-search-forward
-              "[\f\t\n\r()=3D,; ]?\177\\(?:\\([^\n\001]+\\)\001\\)?"
+              "[\f\t\n\r()=3D,;
]?\177\\(?:\\([^\n\001]+?\\)\\(/[fpsbtk]\\)?\001\\)?"
              nil t)
        (push   (prog1 (if (match-beginning 1)
                           ;; There is an explicit tag name.
@@ -1645,7 +1645,10 @@ tag-exact-match-p
   (or (and (eq (char-after (point)) ?\001)
           (eq (char-after (- (point) (length tag) 1)) ?\177))
       ;; We are not on the explicit tag name, but perhaps it follows.
-      (looking-at (concat "[^\177\n]*\177" (regexp-quote tag) "\001"))))
+      (looking-at (concat "[^\177\n]*\177"
+                          (regexp-quote tag)
+                          ;; The optional "/x" part is for Ada tags.
+                          "\\(/[fpsbtk]\\)?\001"))))

 ;; t if point is at a tag line that has an implicit name.
 ;; point should be just after a string that matches TAG.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 26 May 2025 20:13:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 26 16:13:46 2025
Received: from localhost ([127.0.0.1]:60385 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJeCf-0004mz-L8
	for submit <at> debbugs.gnu.org; Mon, 26 May 2025 16:13:46 -0400
Received: from m228-15.mailgun.net ([159.135.228.15]:47604)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2)
 (envelope-from <bounce+229f5e.5fd5d2-78489=debbugs.gnu.org@HIDDEN>)
 id 1uJeCd-0004mh-Co
 for 78489 <at> debbugs.gnu.org; Mon, 26 May 2025 16:13:44 -0400
DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.troybrown.dev;
 q=dns/txt; s=mx; t=1748290411; x=1748297611; 
 h=Content-Transfer-Encoding: Content-Type: Cc: To: To: Subject: Subject:
 Message-ID: Date: From: From: In-Reply-To: References: MIME-Version: Sender:
 Sender; bh=MYCfqLA7mW0C5/dwt4vcMdMM1hpfTRqC0mUivMZK2JA=;
 b=ImjWonm4iYOMSJBQUsO1Ke76jYsjEmbm6agbNfnJYb6/e9CKiagobyb9l8hoPAhA3RNwwa+f2jRCBxfRQPHX15ug2wYyFY/JnnQAPXpVZo6PXoEauK03iGNGeVyIrQpR4YNELM6gM1JrXRyXdrrwo/u6SbnKyoMQwHwRR7n0V7k=
X-Mailgun-Sid: WyJiOTYxMCIsIjc4NDg5QGRlYmJ1Z3MuZ251Lm9yZyIsIjVmZDVkMiJd
Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com
 [209.85.208.43]) by
 8ae5160bb82d with SMTP id 6834cb6b93b9589b86ff44d4 (version=TLS1.3,
 cipher=TLS_AES_128_GCM_SHA256); Mon, 26 May 2025 20:13:31 GMT
X-Mailgun-Sending-Ip-Pool-Name: 
X-Mailgun-Sending-Ip-Pool: 
X-Mailgun-Sending-Ip: 159.135.228.15
Received: by mail-ed1-f43.google.com with SMTP id
 4fb4d7f45d1cf-604533a2f62so3959802a12.3
 for <78489 <at> debbugs.gnu.org>; Mon, 26 May 2025 13:13:31 -0700 (PDT)
X-Gm-Message-State: AOJu0Yx7zycdrozr6AekSj0MGmPQ8/nb1goRDljdzGrAn7uK4Q5TsYrh
 lx4p3Y+T6QpzJFXmfuX7YBkck5KEtm5hO4/HCVtj04tfCbm6HIsvthOakuhv4rPV/cxpQor6i4G
 1blKB1raVulxeet3DURIOpvrQwJa3ub0=
X-Google-Smtp-Source: AGHT+IGmLtoaMxD211Q4vl/FlPxe7UDMAEpNAI4caiHcrYTohpwsTW0PsXyJ/EUDvcmi8CrqzIASYTb2GHE7qoqhu4o=
X-Received: by 2002:a17:907:c12:b0:ad1:fa48:da0a with SMTP id
 a640c23a62f3a-ad85b1c2cfamr920697466b.35.1748290410722; Mon, 26 May 2025
 13:13:30 -0700 (PDT)
MIME-Version: 1.0
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 <86zff46fw5.fsf@HIDDEN>
In-Reply-To: <86zff46fw5.fsf@HIDDEN>
From: Troy Brown <brownts@HIDDEN>
Date: Mon, 26 May 2025 16:13:19 -0400
X-Gmail-Original-Message-ID: <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
X-Gm-Features: AX0GCFt6oGlrDjFrf6l0exRpGFcCbYHGi01K9jk-n3AZXzagO3J5WiDRGy439ig
Message-ID: <CABvCZ40QPNz=4H8jWAOrqEhQD1tGvP1758Ox_aYhztNVDdfduA@HIDDEN>
Subject: Re: bug#78489: 30.1.50; Using etags, Ada and xref-find-definitions
 doesn't find definitions
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Thu, May 22, 2025 at 7:31=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote:
>
> Thanks for the analysis.  Out of curiosity: do you happen to know the
> reasons why Ada tags have these suffixes?  It seems to be Ada-only
> feature, so I wonder what's it about?

The creation of the Ada TAGS support in Emacs predates my involvement,
so unfortunately, I don't know the reasoning behind it, other than
what appears in the manual (wanting to differentiate between symbols
of the same name in different contents).  However, that wouldn't be
unique to Ada.

> I can propose the patch below instead.  Could you please see if it
> solves your problems with Ada tags?

In the testing I've done, this patch works correctly and addresses the
original problem reported.  However, as I explored this a bit further
I discovered another issue that involves completion.  After typing
'Displ' and then `M-x completion-at-point`, the tag including the
suffix is completed (i.e., "Display_Message/p" is inserted into the
buffer, instead of just "Display_Message").




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 22 May 2025 11:31:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 07:31:37 2025
Received: from localhost ([127.0.0.1]:32779 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uI49B-0006Bu-5C
	for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:31:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:33402)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uI496-00068L-8b
 for 78489 <at> debbugs.gnu.org; Thu, 22 May 2025 07:31:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uI48z-000837-Oe; Thu, 22 May 2025 07:31:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=7vYQ3futuu4IG8iaTtcNHrlXFxezSbnrzQ0Uys5b7yQ=; b=fNZQiFMpxAun
 afdyRX6Xjfy9LI3VrRsJfXig+4GnV7PlD1Z6KDaZvs8mgQasC+z0YYJcXGoRs8hjpJFrY2KFYHuZf
 fF9wnYqMBTs7enEV8oQt4RSEf1p0ejnOR7C9p6nPv8fKhrWc0qUfqwizg7Key1ry968Id/oxHesA8
 h3ppx6QokZh4PNXCcWLt4wjkbjTkzXhV2slax12hSCm8rsf6GGsTEdxFBH2Bm+AlRX300vA/V23Qi
 J4yKnY/lcYmE/4Y7N0UZV2GTg60OOkzGpEfzknScO2PlCLB6RMrMs4aSXTCPao10CjNfBDWtWmm9c
 q3LWl3UbWOPEkWsHR9AG0Q==;
Date: Thu, 22 May 2025 14:31:22 +0300
Message-Id: <86zff46fw5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Troy Brown <brownts@HIDDEN>
In-Reply-To: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#78489: 30.1.50;
 Using etags, Ada and xref-find-definitions doesn't find definitions
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sun, 18 May 2025 21:37:19 -0400
> From:  Troy Brown via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> For this issue, you can just load the Ada source into Fundamental
> mode.  The problem doesn't appear to be with the major mode, but
> instead with the etags backend for xref not fully supporting the Ada
> tags generated by etags.  The following source file can be used to
> reproduce the problem (named hello_world.adb):
> 
> --8<---------------cut here---------------start------------->8---
> with Ada.Text_IO; use Ada.Text_IO;
> 
> procedure Hello_World is
>    procedure Display_Message is
>    begin
>       Put_Line ("Hello, World!");
>    end Display_Message;
> begin  -- Hello_World
>    Display_Message;
> end Hello_World;
> --8<---------------cut here---------------end--------------->8---
> 
> 1. Generate TAGS: etags *.adb
> 2. emacs -Q hello_world.adb
> 3. Place point over Display_Message on line 9
> 4. M-x xref-find-definitions
> 5. Select TAGS file previously generated
> 6. Message buffer contains "No definitions found for: Display_Message"
> 
> Digging into this, it appears the reason the definition is not found
> is because of the `etags-xref-find-definitions-tag-order`, or more
> specifically, that `tag-exact-match-p` contained in that list does not
> account for the suffix appended by etags for Ada tags.  According to
> the the Emacs manual [(info "(emacs) Tag Syntax")], Ada tags will
> contain a "/b", "/f", "/k", "/p", "/s" or "/t" suffix to distinguish
> the type of tag.  This can be observed by looking at the contents of
> the generated TAGS file.  When invoking `xref-find-definitions`, the
> symbol at point (i.e., "Display_Message" in this example) will not
> exactly match the tag found in the TAGS file (i.e.,
> "Display_Message/p"), thus the observed "No definitions found"
> message.

Thanks for the analysis.  Out of curiosity: do you happen to know the
reasons why Ada tags have these suffixes?  It seems to be Ada-only
feature, so I wonder what's it about?

> I assume this is just an oversight that `xref-find-definitions` does
> not work out of the box with Ada tags.

Yes.

> The older `M-x find-tag` will work as expected, as well as other
> functions which don't expect an exact match (i.e., `M-x
> xref-find-apropos`).  However, It's surprising that
> `xref-find-definitions` does not work out of the box with the output
> that etags generates.

Xref intentionally switched to exact matches, so as to avoid the extra
step for the user to select one of the possible inexact matches.  But
doing that with Ada needs special handling, due to this idiosyncrasy
of Ada tags.

> It's unclear to me how special handling like this should be handled in
> the etags xref backend.

I can propose the patch below instead.  Could you please see if it
solves your problems with Ada tags?

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 42057a3..f14d915 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1649,7 +1649,10 @@ tag-exact-match-p
   (or (and (eq (char-after (point)) ?\001)
 	   (eq (char-after (- (point) (length tag) 1)) ?\177))
       ;; We are not on the explicit tag name, but perhaps it follows.
-      (looking-at (concat "[^\177\n]*\177" (regexp-quote tag) "\001"))))
+      (looking-at (concat "[^\177\n]*\177"
+                          (regexp-quote tag)
+                          ;; The optional "/x" part is for Ada tags.
+                          "\\(/[fpsbtk]\\)?\001"))))
 
 ;; t if point is at a tag line that has an implicit name.
 ;; point should be just after a string that matches TAG.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at 78489 <at> debbugs.gnu.org:


Received: (at 78489) by debbugs.gnu.org; 22 May 2025 11:31:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 07:31:17 2025
Received: from localhost ([127.0.0.1]:32768 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uI48q-0005tA-Tf
	for submit <at> debbugs.gnu.org; Thu, 22 May 2025 07:31:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41016)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uI48n-0005dB-IG
 for 78489 <at> debbugs.gnu.org; Thu, 22 May 2025 07:31:14 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uI48h-000820-J0; Thu, 22 May 2025 07:31:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=bn+SRtjgxEGRdSqQm/8EWjJxFb+qVV/StcEqXNcz6xA=; b=ghTo7I8aMmcF
 MYOGSli2WrTcMsDjgKvZxFsIa7/dJ3OLT0BSV2tlVo/Co25Ve45uzEr4Sx2jN+XaTK8IG7gugWevg
 K+ndujNRW0uPmKOInnYbpobnV0lwFNxu8XnEtYvUzEU0BYLjfEqW7o6a6O7yYF5G7af3FLDPLNt4v
 +JPkErPgf+SnHlP9JG+HBNah3Eh3sObl2aFLKV2Ea96NBttlearP9vBsjN4eeVxIjJ/lGASCRjovG
 XriBFGBNK3OlO1BPRGyB+B/dgusruYkmfRawa81B8HbfVnKBcxTcJYwUF82qLqUEQ9wTisVrqzzOj
 u0+Lqe5aQBuByySxRh+Z0A==;
Date: Thu, 22 May 2025 14:31:04 +0300
Message-Id: <861psg7uh3.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Troy Brown <brownts@HIDDEN>
In-Reply-To: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
 (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#78489: 30.1.50;
 Using etags, Ada and xref-find-definitions doesn't find definitions
References: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 78489
Cc: 78489 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sun, 18 May 2025 21:37:19 -0400
> From:  Troy Brown via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> For this issue, you can just load the Ada source into Fundamental
> mode.  The problem doesn't appear to be with the major mode, but
> instead with the etags backend for xref not fully supporting the Ada
> tags generated by etags.  The following source file can be used to
> reproduce the problem (named hello_world.adb):
> 
> --8<---------------cut here---------------start------------->8---
> with Ada.Text_IO; use Ada.Text_IO;
> 
> procedure Hello_World is
>    procedure Display_Message is
>    begin
>       Put_Line ("Hello, World!");
>    end Display_Message;
> begin  -- Hello_World
>    Display_Message;
> end Hello_World;
> --8<---------------cut here---------------end--------------->8---
> 
> 1. Generate TAGS: etags *.adb
> 2. emacs -Q hello_world.adb
> 3. Place point over Display_Message on line 9
> 4. M-x xref-find-definitions
> 5. Select TAGS file previously generated
> 6. Message buffer contains "No definitions found for: Display_Message"
> 
> Digging into this, it appears the reason the definition is not found
> is because of the `etags-xref-find-definitions-tag-order`, or more
> specifically, that `tag-exact-match-p` contained in that list does not
> account for the suffix appended by etags for Ada tags.  According to
> the the Emacs manual [(info "(emacs) Tag Syntax")], Ada tags will
> contain a "/b", "/f", "/k", "/p", "/s" or "/t" suffix to distinguish
> the type of tag.  This can be observed by looking at the contents of
> the generated TAGS file.  When invoking `xref-find-definitions`, the
> symbol at point (i.e., "Display_Message" in this example) will not
> exactly match the tag found in the TAGS file (i.e.,
> "Display_Message/p"), thus the observed "No definitions found"
> message.

Thanks for the analysis.  Out of curiosity: do you happen to know the
reasons why Ada tags have these suffixes?  It seems to be Ada-only
feature, so I wonder what's it about?

> I assume this is just an oversight that `xref-find-definitions` does
> not work out of the box with Ada tags.

Yes.

> The older `M-x find-tag` will work as expected, as well as other
> functions which don't expect an exact match (i.e., `M-x
> xref-find-apropos`).  However, It's surprising that
> `xref-find-definitions` does not work out of the box with the output
> that etags generates.

Xref intentionally switched to exact matches, so as to avoid the extra
step for the user to select one of the possible inexact matches.  But
doing that with Ada needs special handling, due to this idiosyncrasy
of Ada tags.

> It's unclear to me how special handling like this should be handled in
> the etags xref backend.

I can propose the patch below instead.  Could you please see if it
solves your problems with Ada tags?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 May 2025 01:38:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 18 21:38:06 2025
Received: from localhost ([127.0.0.1]:34508 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uGpS7-0005gl-Cr
	for submit <at> debbugs.gnu.org; Sun, 18 May 2025 21:38:05 -0400
Received: from lists.gnu.org ([2001:470:142::17]:49678)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <troy.s.brown@HIDDEN>)
 id 1uGpRy-0005g1-Lw
 for submit <at> debbugs.gnu.org; Sun, 18 May 2025 21:37:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <troy.s.brown@HIDDEN>)
 id 1uGpRm-0002KM-Qb
 for bug-gnu-emacs@HIDDEN; Sun, 18 May 2025 21:37:44 -0400
Received: from mail-ej1-f53.google.com ([209.85.218.53])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <troy.s.brown@HIDDEN>)
 id 1uGpRe-0002FV-Tv
 for bug-gnu-emacs@HIDDEN; Sun, 18 May 2025 21:37:42 -0400
Received: by mail-ej1-f53.google.com with SMTP id
 a640c23a62f3a-acb39c45b4eso554134966b.1
 for <bug-gnu-emacs@HIDDEN>; Sun, 18 May 2025 18:37:32 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1747618651; x=1748223451;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=AV3Z81sGdlciTL+6WMCt2cGQHnW29ipxu3DE/byycrw=;
 b=fzEFkqvQE9Z6IfsiezYOy6N49lHCvcX8tDnKb7XcfhTXJo8WRB6c91ozvzqstZY46g
 IoRzoPJ1qejec/gQ4PA0CLcVzPrYcbWXpUsyY3yarqXK6kuYohPdBmXKvT9p5CrYGZyR
 uKfXv8jqxB0f93ghjffXTDvctmO2oczQBXTzUIs5++U/5XtKf5Alrz4dYfoPpPNv+7pe
 3nBDZZVhZdYqXVfRg1hA3Hb3IiSu+xm+ds/SttGs6nXnH9FgDN67SFPCYyOHfcE0aHiM
 j7erf+QzC3qEITh9dgvAKRMyOX4A08MAIsSEmEEE4B5yuF5oF9gtDbfv66swnty9ume6
 VL8A==
X-Gm-Message-State: AOJu0YwYze/JR2cqJ1AwT03d+Ukl0xGOLqrR2pJsV0GbqhsBS9J1GOl+
 dcg88RD8+5nCaVMQqBJ8BgIYoiLz9EQZga/5wKsLJmMUD9R6EspvgyAtEBD4u2sy
X-Gm-Gg: ASbGncvHppLxGVrBhHyrjqF8Kez0VLWu9d3+VZkw2eqlFxxhM+GgZzY1aSeQE+DjzXv
 xKO06bxkGVefU0XvWxEj/1aNY9sdV8ELw5Wby+CxTjY+h8XuCllmT6fMySPZ+VP2nKKLF/ObRkP
 icP47pnONnEQr+uNKpuuhZU2pNGkIRSkmbeWQOau/MMtf+hn7mghFipbsSI5nE7xkQmj/Wrm6VJ
 P10YmiHN+suaYRgfbucAgdELcp93Km7FqHSOTvmBkHinHDlSpUuovrXh05andzh/vfSyr4sD1uA
 pwejdZDfYBna5T0l2x0xNAUQtsrq3oWi39nNVgmaTjAlON89Hj+Di/VodxwyU1qgwptbO0imytk
 lWlKQPask4QOWvw0=
X-Google-Smtp-Source: AGHT+IE/JtiLihq/Syg33Td/R5ND2PF8u3tQ7R1tnut5S1UzHN0dVv1XFuGch9JRUXRbPhfGntHlhQ==
X-Received: by 2002:a17:907:9728:b0:ad5:5302:4023 with SMTP id
 a640c23a62f3a-ad55302638cmr520020166b.44.1747618650779; 
 Sun, 18 May 2025 18:37:30 -0700 (PDT)
Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com.
 [209.85.208.49]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-ad52d498909sm511696266b.126.2025.05.18.18.37.30
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 18 May 2025 18:37:30 -0700 (PDT)
Received: by mail-ed1-f49.google.com with SMTP id
 4fb4d7f45d1cf-6019b564d0bso3123747a12.2
 for <bug-gnu-emacs@HIDDEN>; Sun, 18 May 2025 18:37:30 -0700 (PDT)
X-Received: by 2002:a05:6402:34cd:b0:601:89d4:968e with SMTP id
 4fb4d7f45d1cf-60189d49a3emr8388622a12.27.1747618650177; Sun, 18 May 2025
 18:37:30 -0700 (PDT)
MIME-Version: 1.0
From: Troy Brown <brownts@HIDDEN>
Date: Sun, 18 May 2025 21:37:19 -0400
X-Gmail-Original-Message-ID: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
X-Gm-Features: AX0GCFuznbIbHSqS23l_wkKSz-0zyddBV5nmfmefs1nvWmi-ud8aYotVhU62Mww
Message-ID: <CABvCZ418G19GHRMzAYwv803S2tOifxeZXBvm9CCYvRQmkE9xdQ@HIDDEN>
Subject: 30.1.50;
 Using etags, Ada and xref-find-definitions doesn't find definitions
To: "simon254--- via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=209.85.218.53;
 envelope-from=troy.s.brown@HIDDEN; helo=mail-ej1-f53.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
 FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
 HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001,
 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

For this issue, you can just load the Ada source into Fundamental
mode.  The problem doesn't appear to be with the major mode, but
instead with the etags backend for xref not fully supporting the Ada
tags generated by etags.  The following source file can be used to
reproduce the problem (named hello_world.adb):

--8<---------------cut here---------------start------------->8---
with Ada.Text_IO; use Ada.Text_IO;

procedure Hello_World is
   procedure Display_Message is
   begin
      Put_Line ("Hello, World!");
   end Display_Message;
begin  -- Hello_World
   Display_Message;
end Hello_World;
--8<---------------cut here---------------end--------------->8---

1. Generate TAGS: etags *.adb
2. emacs -Q hello_world.adb
3. Place point over Display_Message on line 9
4. M-x xref-find-definitions
5. Select TAGS file previously generated
6. Message buffer contains "No definitions found for: Display_Message"

Digging into this, it appears the reason the definition is not found
is because of the `etags-xref-find-definitions-tag-order`, or more
specifically, that `tag-exact-match-p` contained in that list does not
account for the suffix appended by etags for Ada tags.  According to
the the Emacs manual [(info "(emacs) Tag Syntax")], Ada tags will
contain a "/b", "/f", "/k", "/p", "/s" or "/t" suffix to distinguish
the type of tag.  This can be observed by looking at the contents of
the generated TAGS file.  When invoking `xref-find-definitions`, the
symbol at point (i.e., "Display_Message" in this example) will not
exactly match the tag found in the TAGS file (i.e.,
"Display_Message/p"), thus the observed "No definitions found"
message.

I assume this is just an oversight that `xref-find-definitions` does
not work out of the box with Ada tags.  The older `M-x find-tag` will
work as expected, as well as other functions which don't expect an
exact match (i.e., `M-x xref-find-apropos`).  However, It's surprising
that `xref-find-definitions` does not work out of the box with the
output that etags generates.

I've worked around this issue by creating `ada-tag-exact-match-p`
which mimics `tag-exact-match-p` but handles the Ada suffixes
generated by etags, and then adding it to
`etags-xref-find-definitions-tag-order`.

--8<---------------cut here---------------start------------->8---
(defun ada-tag-exact-match-p (tag)
  (let* ((ada-tag-suffix (rx "/" (or "b" "f" "k" "p" "s" "t")))
(ada-tag (concat (regexp-quote tag) ada-tag-suffix)))
    (or (and (looking-at (concat ada-tag-suffix (rx ?\001)))
     (eq (char-after (- (point) (length tag) 1)) ?\177))
(looking-at (concat (rx (* (not (or ?\177 ?\n))) ?\177) ada-tag (rx ?\001))))))

(with-eval-after-load 'etags
  (add-to-list 'etags-xref-find-definitions-tag-order
'ada-tag-exact-match-p 'append))
--8<---------------cut here---------------end--------------->8---

It's unclear to me how special handling like this should be handled in
the etags xref backend.




Acknowledgement sent to Troy Brown <brownts@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#78489; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 27 May 2025 15:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.