Hi Dmitry, Thanks for looking over the patch. Here's the recipe for the purported bug in xref.el: 1. Please apply my patch to tex-mode.el (and xref.el). 2. I've attached xref-bug.zip, which contains a directory with 4 identical LaTeX files and one LaTeX file with a single additional character. Please extract it. 3. emacs -Q 4. C-x C-f xref-bug/mwea.ltx, and please don't visit the other 4 files. 5. Put point on \__hook_debug:n in line 6. 6. M-?, RTN, ... RTN, RTN. The xref buffer should offer 5 hits, one from each file in the directory. 7. Comment out the the line I added to xref--collect-matches, byte-compile and load the file. 8. With point in the same place, M-?, RTN, ... RTN, RTN. The xref buffer should offer 3 hits. The first is from the file-visiting buffer (where I also set syntax-propertize--done to 0, because in my testing there could be some issues here, too). The second hit is from the first file opened in *xref-temp. Here, syntax-propertize runs to line-end, and all is well. The next two files are missed, because syntax-propertize--done is set to line-end and they have exactly the same line length as file two, and therefore syntax-propertize thinks that's good enough and doesn't actually change anything. The fifth file has an additional character in line 6, so syntax-propertize decides it needs to work on this line because line-end > syntax-propertize--done. You can put point on, say, \documentclass, and you'll get all 5 hits, because this string doesn't begin or end with a non-word, non-symbol character, and syntax-propertize doesn't need to run. You can make the search string "\documentclass" and you'll get 2 hits, as line 1 has the same length in all 5 files. (It's worth trying "\usepackage" as the search string, too.) That's my diagnosis anyway. Does it make sense? Thanks, David. On Thu, 2 May 2024 at 01:43, Dmitry Gutov wrote: > > On 29/04/2024 17:15, David Fussner via Bug reports for GNU Emacs, the > Swiss army knife of text editors wrote: > > 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.) > > Yes, could you please expand on it separately? > > The rest of the patch description just makes sense to me, and I'd be > happy to leave (or not) the detailed review to whoever reviews TeX > contributions around here, but this is something I'll need to pay > special attention to.