GNU bug report logs - #53749
29.0.50; [PATCH] Xref backend for TeX buffers

Previous Next

Package: emacs;

Reported by: David Fussner <dfussner <at> googlemail.com>

Date: Thu, 3 Feb 2022 15:10:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 31.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #200 received at 53749 <at> debbugs.gnu.org (full text, mbox):

From: David Fussner <dfussner <at> googlemail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 53749 <at> debbugs.gnu.org, Ikumi Keita <ikumi <at> ikumi.que.jp>,
 Arash Esbati <arash <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Tassilo Horn <tsdh <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 stefankangas <at> gmail.com
Subject: Re: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers
Date: Thu, 2 May 2024 14:32:37 +0100
[Message part 1 (text/plain, inline)]
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 <dgutov <at> yandex.ru> 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.
[xref-bug.zip (application/zip, attachment)]

This bug report was last modified 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.