Subject: bug#20629: 25.0.50; Regression: TAGS broken, can't find anything in C++ files.

From: Dmitry Gutov <[email-masked]>
Date: Sat, 30 May 2015 23:04:24 +0300

On 05/30/2015 10:35 PM, Francesco Potortì wrote:

> In the etc/ETAGS.EBNF file you can
> read the complete description that I made at that time.  Here it is:

Yes, thanks. I've read it a few times now. :)

> 1) explicit tag name
> 2) implicit tag name (unnamed tag whose name can be deduced from pattern)
> 3) no tag name (unnamed tag)
>
> In some languages, like C++ and derived, most tags are named.  In
> others, most are unnamed, usually in the simplest languages.

It seems we don't have a suitable predicate for unnamed tags. How does 
one determine whether an entry contains a entirely unnamed tag, or an 
implicitly named one?

>> It's easier to call the value of the tag name field an "explicit tag",
>> and the value that we can derive from the pattern an "implicit tag". And
>> if the explicit tag is present, naturally they'll be different.
>
> The parser
> finds a tag, then it decides whether it should be named or not and in
> the latter case, depending on the tag and the language, what is the
> appropriate tag name.  If the tag should have no name, an unnamed tag is
> created.  If the tag should be named, and if the name can be deduced
> from the pattern, then it creates no explicit name (thus creating an
> unnamed tag with an implicit tag name), else it creates a tag with an
> explicit name.

You're describing how a TAGS file is created. I'm trying to describe how 
one should read it.

> The idea is that when you look for a tag, you first look for the
> (explicit) names in the tag, which are contained in the relevant field.
> If you find one, it's done.

This implies that an explicit name is better than an implicit name (and 
thus should be found/displayed first). That doesn't seem to be the case.

> If it is not, you can try and see if the
> tag you are looking for matches an implicit name.  If you find one, it's
> done.

You should try using the current Emacs master. Now when the user presses 
M-., we try to list all correct matches, not jump to them one by one (if 
there are more than one, of course).

>> This confirms that we should always disregard implicit tag when the
>> explicit tag is present.
>
> I suppose you can view it like this so.  In my language, I would say
> that when an explicit name is present, we have found a name.  That's
> all, no thing like an "implicit tag name" is there to be disregarded.

Present where?

When looking for matches for a given tag, we search through the whole 
TAGS file, and at the end of all textual match try one of the predicates 
(is if an explicit match? is it an implicit match? etc).