Hi Keita,

Thanks for your reply, and I agree with you that it's sort of a choice
between two suboptimal outcomes. I'm not by any means the judge of
what xref should and shouldn't do, that would be Dmitry and the Emacs
maintainers, and it's certainly the case that `xref-find-references'
in general will only search for project files in a particular
language, ignoring all others. The way TeX has evolved means that
there could be some false positives if we search all .tex files in a
project, no matter the major mode of the buffer where we start the
search. My argument in favor of doing this is threefold:

1. How false are these false positives? If it's a project with plain
TeX and LaTeX files, there's always a certain amount of overlap
anyway, and that includes amsTeX, too. ConTeXt is another problem, so
it will depend somewhat on the nature of the project.

2. If you create a TAGS file in the project, then typically that will
cover all the .tex files, too, so the other xref commands may find
hits across the various TeX varieties, and therefore
`xref-find-references' won't be an outlier in that respect.

3. I also feel -- quite strongly as it happens -- that false negatives
are worse than false positives. If you've a .tex file open and do M-?
in it then you won't even see the hit point is on, but only hits from
whatever other file extensions happen to belong to the initial file's
major mode. Currently, in the case of plain TeX or ams TeX, that means
no hits, which is sort of weird and very frustrating when you're
looking at one on your screen. In a LaTeX .tex file you'll also not
get the hit you're actually looking at on your screen, but this might
be disguised by hits from other file extensions. I think this is much
more misleading than any false positives, but I concede that others
may not feel as strongly about this as I do.

I should probably add that, if Emacs does decide to accept the new
xref backend for tex-mode.el, then as it stands it will add the
current buffer's file extension to `semantic-symref-filepattern-alist'
automatically for the rest of the Emacs session, if it isn't already
there. This probably isn't very neighborly of me, so I guess depending
on what you decide about this request I may have to reconsider what
happens automatically in tex-mode.el. What do you think?

Best, David.

On Wed, 29 May 2024 at 07:22, Ikumi Keita <ik...@ikumi.que.jp> wrote:
>
> Hi David,
>
> >>>>> David Fussner via bug-auctex via Bug reporting list for AUCTeX 
> >>>>> <bug-auctex@gnu.org> writes:
> > The patchset for the new xref backend in tex-mode.el is still pending,
> > but no matter what the eventual outcome of that I think we still need to
> > have a complete set of AUCTeX modes included in
> > `semantic-symref-filepattern-alist'. Without them we just get the
> > cryptic message about customizing that variable when we try to use
> > `xref-find-references'. Also, I don't know whether it was decided not to
> > include the .tex extension where relevant, but this does mean that,
> > without further intervention, `xref-find-references' won't search .tex
> > files in any of the modes, even when you are actually searching from,
> > say, a LaTeX-mode .tex file. This seems suboptimal to me. I attach a
> > patch for your consideration.
>
> Thanks for your proposal. Actually, I'm not sure what to do with this
> issue.
>
> As you say, .tex extension is shared among LaTeX, plain TeX and ConTeXt.
> (I think we can ignore SliTeX and AmSTeX.) When AUCTeX adds .tex to
> `semantic-symref-filepattern-alist', `xref-find-references' searches all
> .tex files, if I understand correctly. Therefore, if LaTeX files and
> plain TeX files are in the same directory, M-? typed in the LaTeX file
> buffers would look into plain TeX files as well. In theory, this can
> lead to false positive result. Is this legitimate behavior for xref.el?
> If it is for sure, I think AUCTeX can accept your patch.
> (Or, maybe AUCTeX should have a new customize option to control to have
> .tex extension in `semantic-symref-filepattern-alist' so that users
> can decide to allow such false positives or not?)
>
> Regards,
> Ikumi Keita
> #StandWithUkraine #StopWarInUkraine
> #Gaza #StopMassiveKilling #CeasefireNOW



_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex
  • bug#71245: ... David Fussner via bug-auctex via Bug reporting list for AUCTeX
    • bug#71... Ikumi Keita
      • bu... David Fussner via bug-auctex via Bug reporting list for AUCTeX
        • ... Ikumi Keita
          • ... David Fussner via bug-auctex via Bug reporting list for AUCTeX
            • ... Ikumi Keita
          • ... Arash Esbati
            • ... David Fussner via bug-auctex via Bug reporting list for AUCTeX

Reply via email to