Hi Arash, I've adjusted the commit message as best I could (it wasn't 100% clear to me whether the summary line should appear "twice", both in the subject and in the first line of the commit message), and can't remember any reason not to just use setq, so I've changed it to that. Any further feedback is welcome. Thanks, best, Paul On Mon, Apr 8, 2024 at 2:44 PM Arash Esbati wrote: > > Hi Paul, > > Paul Nelson writes: > > > OK, very well. Please find attached my best attempt at a patch for > > this (any feedback or corrections welcome). > > Thanks. I have 2 questions, see below: > > > From 9d3266304f62fa3b21751b27200aab17454add6c Mon Sep 17 00:00:00 2001 > > From: Paul Nelson > > Date: Mon, 8 Apr 2024 13:11:52 +0200 > > Subject: [PATCH] fix bug with preview-region applied to repeated math > > environments > > > > See https://www.mail-archive.com/bug-auctex@gnu.org/msg04327.html. > > Can you try to adjust the commit message as described here: > > https://git.savannah.gnu.org/cgit/emacs.git/tree/CONTRIBUTE#n172 > > If not, I will try to fix that afterwards. > > > --- > > preview.el.in | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/preview.el.in b/preview.el.in > > index 09836d9..72c5e58 100644 > > --- a/preview.el.in > > +++ b/preview.el.in > > @@ -3268,6 +3268,8 @@ Return a new string." > > (setq result (concat result string)) > > result)) > > > > +(defvar-local preview--region-begin nil) > > + > > (defun preview-parse-messages (open-closure) > > "Turn all preview snippets into overlays. > > This parses the pseudo error messages from the preview > > @@ -3538,6 +3540,14 @@ name(\\([^)]+\\))\\)\\|\ > > (goto-char (point-min)) > > (forward-line (1- line))) > > (setq lpoint (point)) > > + > > + ;; The following addresses the bug described at > > + ;; https://www.mail-archive.com/bug-auctex@gnu.org/msg04327.html > > + (and preview--region-begin > > + (< (point) > > + preview--region-begin) > > + (goto-char preview--region-begin)) > > + > > (cond > > ((search-forward (concat string after-string) > > (line-end-position) t) > > @@ -4033,6 +4043,7 @@ stored in `preview-dumped-alist'." > > "") > > (TeX-current-offset begin))) > > (setq TeX-current-process-region-p t) > > + (setq-local preview--region-begin begin) > > Why `setq-local'? You define `preview--region-begin' with > `defvar-local', why not just `setq' it? > > Best, arash