Subject: Re: bug#19468: 25.0.50; UI inconveniences with M-.

From: Stefan Monnier <[email-masked]>
Date: Mon, 27 Apr 2015 17:54:30 -0400

> Emacs 24 also had "C-u M-." to go to the next one.  This one doesn't;
> moreover, if you try "C-u M-.", you get prompted for the symbol again,
> and if you type the same one, you get nowhere.  The other matches are
> only available via completion, see below.

Maybe we should write an xref-old-ui-mode.
It would make M-. always prompt and it would always jump to the first
entry and then let you use C-u M-. to jump to the next match.

>> But popping up the *xref* buffer when there's only one element in it
>> doesn't make much sense I think.
> Oh, but there shouldn't be only one element: you will see the others
> if you type TAB instead of RET.

No: there's only one definition of `find-tag' so Elisp's xref backend
just returns that one and that's it.

> IOW, the elisp-mode back-end does know about the other candidates, it
> just doesn't show them in *xref*.

None of the others are definitions of `find-tag'.

Arguably, the find-tag advice in org-ctags.el could be offered as well,
if org-ctags.el happens to be loaded (tho currently we could only do
that for an advice added via advice-add rather than via defadvice since
defadvice does not keep track of the origin).

> It somehow decided for me that I want only the exact match.

It's rather that the old etags interface was not sure enough of itself,
so it offered anything that had "find-tag" as a substring somewhere,
i.e. lots and lots of false positives.

> And btw, there is another confusing difference between these back-ends
> that somehow bubbles up to the UI level: the elisp-mode back-end only
> supports finding multiple matches via completion,

No.  `semantic-symref-find-tags-by-name' is not a match for "show me the
definition of find-tag" and neither is "find-tag-tag".  The problem here
is that the current etags xref backend returns confusingly many
so-called "matches" which are really irrelevant and should only be
included in the completions.

There's a difference between:

  I know the name, I need to find out its definition.

and

  I remember the name includes something like "find-tag"

The old code did not distinguish between the two, but the new code does.
I think that's an important feature of the new code in this respect.

        Stefan