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

From: Arash Esbati <[email-masked]>
Date: Wed, 03 Apr 2024 20:33:24 +0200

Paul Nelson <[email-masked]> writes:

> I think a fix would be to store the beginning of the region being
> previewed in a buffer-local variable and, if needed, bump the point
> when searching for where to place the overlay.  Details:
>
> - Add the following line somewhere in preview.el:
>   #+begin_src elisp
>   (defvar-local preview-region--begin nil "Start of region being processed.")
>   #+end_src
>
> - Add the following line to ~preview-region~, just before the
>   invocation of ~preview-generate-preview~:
>   #+begin_src elisp
>   (setq-local preview-region--begin begin)
>   #+end_src
>
> - Add this to ~preview-parse-messages~, just before the second ~cond~ block:
>   #+begin_src elisp
>   (when (< (point) preview-region--begin)
>     (goto-char preview-region--begin))
>   #+end_src
>
> I've made these changes in my local version and they have worked for
> me.

Hi Paul,

thanks for your report and the analysis.  Can you provide a patch for
this change?  We can then install it, if it still works for you and
you're happy with it.

Best, Arash