From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#28403: 25.2; find-tag works, but xref-find-definitions Date: Sun, 10 Sep 2017 22:09:28 +0300 Message-ID: <83tw0atlp3.fsf@gnu.org> References: <201709101827.v8AIRMse018692@psr.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1505070686 783 195.159.176.226 (10 Sep 2017 19:11:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Sep 2017 19:11:26 +0000 (UTC) Cc: 28403@debbugs.gnu.org, dgutov@yandex.ru To: Winston Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 10 21:11:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dr7dL-0007fB-BN for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Sep 2017 21:11:07 +0200 Original-Received: from localhost ([::1]:54003 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr7dQ-0000GB-QM for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Sep 2017 15:11:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr7dJ-0000Fy-93 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 15:11:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dr7dG-00060P-3n for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 15:11:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51016) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dr7dF-00060J-W6 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 15:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dr7dF-00076J-R4 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2017 15:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Sep 2017 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28403 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28403-submit@debbugs.gnu.org id=B28403.150507061227228 (code B ref 28403); Sun, 10 Sep 2017 19:11:01 +0000 Original-Received: (at 28403) by debbugs.gnu.org; 10 Sep 2017 19:10:12 +0000 Original-Received: from localhost ([127.0.0.1]:59694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dr7cR-000755-TC for submit@debbugs.gnu.org; Sun, 10 Sep 2017 15:10:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:59189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dr7cQ-00074t-Al for 28403@debbugs.gnu.org; Sun, 10 Sep 2017 15:10:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dr7cI-0005gH-4R for 28403@debbugs.gnu.org; Sun, 10 Sep 2017 15:10:05 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr7cI-0005gD-0e; Sun, 10 Sep 2017 15:10:02 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3576 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dr7c7-00012y-4H; Sun, 10 Sep 2017 15:10:01 -0400 In-reply-to: <201709101827.v8AIRMse018692@psr.com> (message from Winston on Sun, 10 Sep 2017 14:27 EDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136740 Archived-At: > Date: Sun, 10 Sep 2017 14:27 EDT > From: Winston > Cc: dgutov@yandex.ru, 28403@debbugs.gnu.org > > Eli kindly replied: > > Could you please post a complete example of the code in question, > > including the definition of the _ARGS1 macro, and any other macros and > > typedefs that would make the example stand-alone? I think I > > understand what has happened, but I'd like to be sure before we decide > > what to do about it. > > Sure (well, it's a semi-complete example). [...] Thanks, this confirms my suspicion: as Dmitry says, etags produces TAGS for the _ARG# macros, and doesn't see the function names. So the fact that find-tag finds the functions is just sheer luck: it falls back to more or less simple text search, so it can find anything you have in the TAGS tables. To have xref-find-definitions work in this case, you need to help etags a bit, see below. > > [The new xref function] is already better in several areas: > > I noticed that, and I liked seeing the list of matches when there's >1, > rather than having to do {arg} find-tag, possibly repeatedly, when the > one find-tag finds first isn't the one I wanted. However, if the basic > find wasn't going to work, or was going to have a lot of false positives, > then I'd stick with find-tag, which has generally worked well (almost no > wrong matches, but it helps that my code tries to have all function > names in all files be unique, even when they're static, so there's > rarely >1 match). Again, it seems to work well in your case because you take special precautions to avoid producing symbols that would generate false positives. But that is a fragile solution, IMO. > > It is even possible that, given the details I requested above, I will > > be able to help you get your use case working with xref, so please > > don't give up on xref, not just yet. > > I haven't. :) Good, because here's how I suggest you invoke etags to solve the problems with the _ARGS# macros: etags --regex="/[ \t]*\([^ \t]+\)[ \t]+_ARGS/\1/" ... (replace "..." with all the other arguments you normally give when you invoke etags). This will tell etags to tag the symbols immediately preceding the _ARGS# macro invocations _in_addition_ to what it already does. Then you can use xref-find-definitions in its default configuration, and it will find your functions. (The --regexp switch to etags is described in the Emacs manual.)