Hi Dmitry and Arash, Here's my third attempt at a working xref backend for TeX. I'll try quickly to summarize what's in it: 1. I've modified etags so that it creates findable tags for as many different sorts of TeX construct as possible, including those written in the new expl3 syntax. I've now removed the escape character from the tag names, as this simplifies code all around. 2. 4 of the 6 xref backend functions just call the etags backend. 3. xref-backend-identifier-at-point is modified to provide new regexps for delineating TeX symbols, and there's also code to cope with expl3 constructs slightly differently in M-? than in the other two main xref commands. 4. xref-backend-references is a wrapper for the standard backend, the wrapper doing two things: first, it tries to accumulate as many file extensions for the current major-mode as emacs knows about, and second it creates a bespoke syntax-propertize-function for strings that aren't entirely composed of symbol or word characters. It applies this function to file-visiting buffers and lets xref apply it in the *xref-temp buffer, though I had to add a one-liner in xref.el to fix what I believe is a minor bug there preventing syntax-propertize from doing its work when the temp buffer holds text from a new file. (I can provide a recipe for this if you want.) 5. Slightly unrelatedly, I've added new syntax-propertize-rules to latex-mode so that expl3 constructs with the underscore aren't fontified as subscripts, which makes such code unreadable. I'm happy to split this off as another patch. All comments gratefully received, and thanks, David. On Mon, 22 Apr 2024 at 14:06, Arash Esbati wrote: > > David Fussner writes: > > > Thanks for the clarifications. If you look at the current patch to > > tex-mode.el, there's one function call added to TeX-mode-hook, mainly > > for my own testing purposes, but no matter what the final patch looks > > like it should only similarly require a single function call in an > > AUCTeX hook to activate the new xref code there, along with one in > > tex-common-initialization for the in-tree modes. If and when all > > parties are satisfied by the patch I'll certainly be in touch with you > > to find out how you'd prefer to handle activating it (or not) in > > AUCTeX. The current state of affairs is a convenience for me and for > > anyone else who cares to test the code. > > Hi David, > > I justed wanted to come back on this report and ask if there is any > progress? It would be nice to get Xref working within TeX buffers. > > TIA. Best, Arash