Subject: bug#62445: 13.1.10; bug in preview-region applied to repeated math environments

From: David Kastrup <[email-masked]>
Date: Sat, 25 Mar 2023 17:41:02 +0100

Paul Nelson <[email-masked]> writes:

> Emacs  : GNU Emacs 29.0.50 (build 3, x86_64-apple-darwin21.6.0, NS
> appkit-2113.60 Version 12.6 (Build 21G115))
>  of 2022-11-06
> Package: 13.1.10
>
> Take the following document:
>
> #+begin_src latex
> \documentclass{amsart}
> \begin{document}
>  $x$ $x$
> \end{document}
> #+end_src
>
>
> Run ~preview-region~ on the region consisting of the first $x$.  This works
> as expected.
>
> Next, run ~preview-region~ on the region consisting of just the second
> $x$.  This does not preview the second $x$.  Instead, it refreshes the
> overlay on the first $x$.
>
> The relevant output:
>
> #+begin_quote
> ./_region_.tex:5: Preview: Snippet 1 started.
> <-><->
>
> l.5 $
>      x$
> Preview: Tightpage -32891 -32891 32891 32891
> ./_region_.tex:5: Preview: Snippet 1 ended.(282168+0x374556).
> <-><->
>
> l.5 $x$
>
> #+end_quote
>
>
> The issue here is that there's not enough context for
> ~preview-parse-messages~ to determine which $x$ to overlay.

I'd just add -file-line-error to the options you are calling TeX with.
That makes for more reliable error message interpretation.

-- 
David Kastrup