Subject: bug#70816: 29.2; Flymake fails in latex-mode when the buffer is narrowed

From: Spencer Baugh <[email-masked]>
Date: Sat, 18 May 2024 10:58:05 -0400

Spencer Baugh <[email-masked]> writes:
> Can you test with the following patch, please?

Context:

It looks like the latex-mode flymake diagnostic function, tex-chktex,
widens before sending the buffer contents to the external linter
process.  So the line numbers of errors are reported relative to the
widened buffer, not the narrowed buffer.  A number of different checkers
in Emacs seem to do the same thing.

The bug is that these checkers call flymake-diag-region to translate the
line numbers into buffer positions.  But flymake-diag-region does not
widen the buffer when doing this translation, so it fails.

I expect you have some flymake logs of the form "Invalid region line=%s
col=%s". when triggering this bug.

Probably the right fix in flymake is to make flymake-diag-region widen,
as in the patch I posted, but that's a bit of a behavior change...  will
think about it, but it's probably fine.