GNU bug report logs - #62445
13.1.10; bug in preview-region applied to repeated math environments

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: auctex; Reported by: Paul Nelson <ultrono@HIDDEN>; Done: Arash Esbati <arash@HIDDEN>; Maintainer for auctex is bug-auctex@HIDDEN.

Message received at 62445-done <at> debbugs.gnu.org:


Received: (at 62445-done) by debbugs.gnu.org; 8 Apr 2024 19:37:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 15:37:54 2024
Received: from localhost ([127.0.0.1]:47738 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rtuoU-0001L1-6a
	for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 15:37:54 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60488)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1rtuoR-0001Jz-Dp
 for 62445-done <at> debbugs.gnu.org; Mon, 08 Apr 2024 15:37:52 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arash@HIDDEN>)
 id 1rtuoE-0004t7-GA; Mon, 08 Apr 2024 15:37:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=o6kWK0IlOGNQ3IRu8x011FxmNAf0JUf8wH+TdEsaXFw=; b=PpH7T6FqzXFvBskyElqT
 z1/yYWOKs0NmvaXOfRYJZpz0t68jyP0OQujibXdlZ0IeZFea129n9rwPVxQSK3zlyWquxcmq39PMV
 WLyvp192/i0WkpIk67emDemImTHDHEaZOtnTEKq5NPRBBmpX1Z69DtkHCVb31uj8F3Em2oqEjmYos
 /1WS/fW8fJljfA3BBii85KZp3Da8nTBRxYrz9iMqGq6FgQ7t/k+Ho5jF5epesjrTpDcho/qCmIZ3x
 +xSTdCx8YsaR33OXmBlo4diOXjBV5ZqdEh0BadoFOYqPC7pSAZqbowLgbC4+VAx3HX8IUaykHDFzR
 uNM/FX+2Am2p0w==;
From: Arash Esbati <arash@HIDDEN>
To: Paul Nelson <ultrono@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
In-Reply-To: <CAOA-32Ph1TgZEz-hKGJO2d_mkumCLAtZ_iOMQO54sXFrKryZ_g@HIDDEN>
 (Paul Nelson's message of "Mon, 8 Apr 2024 17:50:50 +0200")
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <m2msqafg97.fsf@HIDDEN>
 <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
 <m2o7aq3yxg.fsf@HIDDEN>
 <CAOA-32Mop0U9fM6b4rjDbfMZQt7sDDark9rMQvtagDS6PQvVEw@HIDDEN>
 <m2wmp8nhwr.fsf@HIDDEN>
 <CAOA-32Ph1TgZEz-hKGJO2d_mkumCLAtZ_iOMQO54sXFrKryZ_g@HIDDEN>
Date: Mon, 08 Apr 2024 21:37:06 +0200
Message-ID: <m2pluztzml.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62445-done
Cc: 62445-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Paul Nelson <ultrono@HIDDEN> writes:

> 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.

Hi Paul,

thanks for considering my remarks.  I slightly changed your last
proposal and installed it on master (b4dde3e325); I hope it's Ok for
you.

Again, many thanks for your contribution and sorry for the delay at our
end.  I'm closing this report.

Best, Arash




Notification sent to Paul Nelson <ultrono@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Arash Esbati <arash@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 8 Apr 2024 15:51:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 11:51:18 2024
Received: from localhost ([127.0.0.1]:47444 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rtrHB-0008FN-Py
	for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 11:51:18 -0400
Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:47333)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ultrono@HIDDEN>) id 1rtrH9-0008EN-CC
 for 62445 <at> debbugs.gnu.org; Mon, 08 Apr 2024 11:51:16 -0400
Received: by mail-io1-xd29.google.com with SMTP id
 ca18e2360f4ac-7cc77e74b5cso212680039f.2
 for <62445 <at> debbugs.gnu.org>; Mon, 08 Apr 2024 08:51:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712591462; x=1713196262; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=lZcah7kOh8oLO6Gm0c9cDvg7ImX6R8RTTkzXJd9Ttn0=;
 b=Wd+zwhy3ipRBCz/wI/t1f71ns5Yp6vu9428sgFyqY4A+kIy1eINtPCL/HaYkMyCfZQ
 NoL362xe5X11EDw4EOVY+4YQWAvSpJvYgJ276nxUeQIMZAjQM6TyHTfNdSVgshssmfw5
 Ilia77jfB/xwya288PKveCpdXoIPtikvrd1uS2Zk4z6SnBN0Tp+PYh3+dD42xyU/qWSw
 8Vk8ps0+Vkt6oO+DT4tMhO3nneRWFT4jVJ0ptMve5QoLnGB8hXm5tQL4gXCyt5M2ID9k
 lpio6TgSWH3CkKHWh6O+hwb7xCLnem2VPZQ60mkX/EfT7suBbFnnR1o0Z712VRY7HhfC
 Wqkg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712591462; x=1713196262;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=lZcah7kOh8oLO6Gm0c9cDvg7ImX6R8RTTkzXJd9Ttn0=;
 b=Oo5/zdz4QKE0Z7dpKdl+DDPEhDmhOg/okPSpw7tly1ws9JnF6qZ7vEeAC02rWSuxh2
 9N33BsdieYj3D7NOFG4kc8CQG5hg849mgowlBBiixGUPRy3kHWDTz+Q3gjAQQ/qBZV51
 RkG8yD7rN8aT7rDDGtnSj+Im4xjvK6lwAzysRFfPEoKanPsBdTQix6LwppzzkG+/Bjhg
 diFvMZDk2z/5uwg51e7huhk64SWkq5W9tqLLHS+1vqeaBMHnb7W2ruQwf7dtIdYqaPDD
 9CJJVNHFd5/eCNkOodCLDH+i8b7168rAHuaoxxP0zCB285fC1x02AkuTrPTQWxCNm+jU
 G7vg==
X-Gm-Message-State: AOJu0YzmT07s4j/ipQxL1AK/KLefMqfAsZ6j0CA7xWwPFj2q6bGmv7bc
 xyYQSD6fZ9+MDMtJkzSw4uTYKYAI/8g0vApgBWTrsrE7wCl+6j832CMU4xBqdRzFMzKppXUghaq
 jQM8LsBz5jYjfwIpPRKErkFkKh7k=
X-Google-Smtp-Source: AGHT+IFkjoMY2qnGk9T3YoHoMjlQErprjh6CtK+G8HuuBezM6mE3jDEgiXoXSyhxiMxbmCOWZW3umf5K4s0F/JGxauU=
X-Received: by 2002:a5d:964d:0:b0:7d0:d84d:9e13 with SMTP id
 d13-20020a5d964d000000b007d0d84d9e13mr9659632ios.19.1712591461841; Mon, 08
 Apr 2024 08:51:01 -0700 (PDT)
MIME-Version: 1.0
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <m2msqafg97.fsf@HIDDEN>
 <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
 <m2o7aq3yxg.fsf@HIDDEN>
 <CAOA-32Mop0U9fM6b4rjDbfMZQt7sDDark9rMQvtagDS6PQvVEw@HIDDEN>
 <m2wmp8nhwr.fsf@HIDDEN>
In-Reply-To: <m2wmp8nhwr.fsf@HIDDEN>
From: Paul Nelson <ultrono@HIDDEN>
Date: Mon, 8 Apr 2024 17:50:50 +0200
Message-ID: <CAOA-32Ph1TgZEz-hKGJO2d_mkumCLAtZ_iOMQO54sXFrKryZ_g@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
To: Arash Esbati <arash@HIDDEN>
Content-Type: multipart/mixed; boundary="000000000000ba9b3a061597c5b1"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000ba9b3a061597c5b1
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=E2=80=AFPM Arash Esbati <arash@HIDDEN> wrote:
>
> Hi Paul,
>
> Paul Nelson <ultrono@HIDDEN> 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 <ultrono@HIDDEN>
> > 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@HIDDEN/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@HIDDEN=
rg/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'."
> >                           "<none>")
> >                         (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

--000000000000ba9b3a061597c5b1
Content-Type: application/octet-stream; 
	name="0001-Fix-preview-region-bug-with-repeated-math-envs.patch"
Content-Disposition: attachment; 
	filename="0001-Fix-preview-region-bug-with-repeated-math-envs.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_lur4pqo30>
X-Attachment-Id: f_lur4pqo30

RnJvbSAyMDNhMzZmMDZlY2M1OGM2ZmFkZTQxZDQ5NDg0NzFiMzVhOTM2MWFkIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIE5lbHNvbiA8dWx0cm9ub0BnbWFpbC5jb20+CkRhdGU6
IE1vbiwgOCBBcHIgMjAyNCAxMzoxMTo1MiArMDIwMApTdWJqZWN0OiBbUEFUQ0hdIEZpeCBwcmV2
aWV3LXJlZ2lvbiBidWcgd2l0aCByZXBlYXRlZCBtYXRoIGVudnMKCiogcHJldmlldy5lbC5pbiAo
cHJldmlldy1yZWdpb24sIHByZXZpZXctLXJlZ2lvbi1iZWdpbikKKHByZXZpZXctcGFyc2UtbWVz
c2FnZXMpOiBNYWtlIHByZXZpZXctcmVnaW9uIHdvcmsgY29ycmVjdGx5CndoZW4gYXBwbGllZCB0
bywgZS5nLiwgdGhlIHNlY29uZCAiJHgkIiBpbiAiJHgkICR4JCIKKEJ1ZyM2MjQ0NSkuCi0tLQog
cHJldmlldy5lbC5pbiB8IDExICsrKysrKysrKysrCiAxIGZpbGUgY2hhbmdlZCwgMTEgaW5zZXJ0
aW9ucygrKQoKZGlmZiAtLWdpdCBhL3ByZXZpZXcuZWwuaW4gYi9wcmV2aWV3LmVsLmluCmluZGV4
IDA5ODM2ZDkuLjIyOGU1ZGUgMTAwNjQ0Ci0tLSBhL3ByZXZpZXcuZWwuaW4KKysrIGIvcHJldmll
dy5lbC5pbgpAQCAtMzI2OCw2ICszMjY4LDggQEAgUmV0dXJuIGEgbmV3IHN0cmluZy4iCiAgICAg
KHNldHEgcmVzdWx0IChjb25jYXQgcmVzdWx0IHN0cmluZykpCiAgICAgcmVzdWx0KSkKIAorKGRl
ZnZhci1sb2NhbCBwcmV2aWV3LS1yZWdpb24tYmVnaW4gbmlsKQorCiAoZGVmdW4gcHJldmlldy1w
YXJzZS1tZXNzYWdlcyAob3Blbi1jbG9zdXJlKQogICAiVHVybiBhbGwgcHJldmlldyBzbmlwcGV0
cyBpbnRvIG92ZXJsYXlzLgogVGhpcyBwYXJzZXMgdGhlIHBzZXVkbyBlcnJvciBtZXNzYWdlcyBm
cm9tIHRoZSBwcmV2aWV3CkBAIC0zNTM4LDYgKzM1NDAsMTQgQEAgbmFtZShcXChbXildK1xcKSlc
XClcXHxcCiAgICAgICAgICAgICAgICAgICAgICAgICAoZ290by1jaGFyIChwb2ludC1taW4pKQog
ICAgICAgICAgICAgICAgICAgICAgICAgKGZvcndhcmQtbGluZSAoMS0gbGluZSkpKQogICAgICAg
ICAgICAgICAgICAgICAgIChzZXRxIGxwb2ludCAocG9pbnQpKQorCisgICAgICAgICAgICAgICAg
ICAgICAgOzsgVGhlIGZvbGxvd2luZyBhZGRyZXNzZXMgdGhlIGJ1ZyBkZXNjcmliZWQgYXQKKyAg
ICAgICAgICAgICAgICAgICAgICA7OyBodHRwczovL3d3dy5tYWlsLWFyY2hpdmUuY29tL2J1Zy1h
dWN0ZXhAZ251Lm9yZy9tc2cwNDMyNy5odG1sCisgICAgICAgICAgICAgICAgICAgICAgKGFuZCBw
cmV2aWV3LS1yZWdpb24tYmVnaW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICg8IChwb2lu
dCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZpZXctLXJlZ2lvbi1iZWdpbikK
KyAgICAgICAgICAgICAgICAgICAgICAgICAgIChnb3RvLWNoYXIgcHJldmlldy0tcmVnaW9uLWJl
Z2luKSkKKwogICAgICAgICAgICAgICAgICAgICAgIChjb25kCiAgICAgICAgICAgICAgICAgICAg
ICAgICgoc2VhcmNoLWZvcndhcmQgKGNvbmNhdCBzdHJpbmcgYWZ0ZXItc3RyaW5nKQogICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsaW5lLWVuZC1wb3NpdGlvbikgdCkK
QEAgLTQwMzMsNiArNDA0Myw3IEBAIHN0b3JlZCBpbiBgcHJldmlldy1kdW1wZWQtYWxpc3QnLiIK
ICAgICAgICAgICAgICAgICAgICAgICAgICAiPG5vbmU+IikKICAgICAgICAgICAgICAgICAgICAg
ICAgKFRlWC1jdXJyZW50LW9mZnNldCBiZWdpbikpKQogICAoc2V0cSBUZVgtY3VycmVudC1wcm9j
ZXNzLXJlZ2lvbi1wIHQpCisgIChzZXRxIHByZXZpZXctLXJlZ2lvbi1iZWdpbiBiZWdpbikKICAg
KHByZXZpZXctZ2VuZXJhdGUtcHJldmlldyAoVGVYLXJlZ2lvbi1maWxlKQogICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIChwcmV2aWV3LWRvLXJlcGxhY2VtZW50cwogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAoVGVYLWNvbW1hbmQtZXhwYW5kCi0tIAoyLjM5LjMgKEFwcGxlIEdpdC0x
NDUpCgo=
--000000000000ba9b3a061597c5b1--




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 8 Apr 2024 12:44:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 08:44:25 2024
Received: from localhost ([127.0.0.1]:45542 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rtoMK-00006M-Pr
	for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 08:44:25 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57094)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1rtoMH-00005G-Ng
 for 62445 <at> debbugs.gnu.org; Mon, 08 Apr 2024 08:44:23 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arash@HIDDEN>)
 id 1rtoM4-00030t-Su; Mon, 08 Apr 2024 08:44:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=lLKSFzuzNoOVcsqyxpJJdlgu5LwEDWAL1UNteK6tPAs=; b=ROa3mwkYw7kGyiYsggVx
 QaTzwGV9G3X9WqXBq14Oh6ZJyby5S0zuKpK6NSz262oMGj+9fxmEbWNwGx85bOmt84GtQeOcxKH7l
 ZbiOxwB1hlzZDFqJ6auMgHp26BMoBZsEqcAsgR6LGu2q8C/orKWt3UEJRU15axhf19yrXgFpTdTeO
 KVqUX+B31TQQi75aVFF5lESHaiamNK4k4cqXme+WMkCTOR9MDjMwoKPGXQWOb6JKMzJPviDjibiLE
 PsrbQE+mL8cCYcq7liv9YU7DzOzC36+28Fe3gatC/+7YelmtB5ICpgL+0dQGJd7Meahcti+okC7NT
 DmwAdbl9YiiwfA==;
From: Arash Esbati <arash@HIDDEN>
To: Paul Nelson <ultrono@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
In-Reply-To: <CAOA-32Mop0U9fM6b4rjDbfMZQt7sDDark9rMQvtagDS6PQvVEw@HIDDEN>
 (Paul Nelson's message of "Mon, 8 Apr 2024 13:21:26 +0200")
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <m2msqafg97.fsf@HIDDEN>
 <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
 <m2o7aq3yxg.fsf@HIDDEN>
 <CAOA-32Mop0U9fM6b4rjDbfMZQt7sDDark9rMQvtagDS6PQvVEw@HIDDEN>
Date: Mon, 08 Apr 2024 14:44:04 +0200
Message-ID: <m2wmp8nhwr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Paul,

Paul Nelson <ultrono@HIDDEN> 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 <ultrono@HIDDEN>
> 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@HIDDEN/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@HIDDEN/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'."
>                           "<none>")
>                         (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




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 8 Apr 2024 11:21:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 08 07:21:55 2024
Received: from localhost ([127.0.0.1]:45384 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rtn4U-0002P7-KG
	for submit <at> debbugs.gnu.org; Mon, 08 Apr 2024 07:21:55 -0400
Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:45206)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ultrono@HIDDEN>) id 1rtn4R-0002Ny-NI
 for 62445 <at> debbugs.gnu.org; Mon, 08 Apr 2024 07:21:53 -0400
Received: by mail-io1-xd2f.google.com with SMTP id
 ca18e2360f4ac-7d5e19d18fbso31846339f.2
 for <62445 <at> debbugs.gnu.org>; Mon, 08 Apr 2024 04:21:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712575298; x=1713180098; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=8qfTVCJvdgP5aRz71WIYHWHuEldQdJKe2Gxq57j5kDQ=;
 b=gx/k5zYjDhi7mAr9IHsK19MqOqn14AuO+T8yoR2OuLhj6CLcF3CIcR2FW9TGZ7Lgmp
 aX+BwOEUZYUgCK01ZIANsJ+iTvIhc+UsO9oQ4fl2zbJUmBFfqof5owdDsi7rNw4tltbD
 MG1wSSlBdxuznF5jwMbT973/cSWK6TlR/CnAmax+DHU6fhrj+C+1N26kQILJI95f9Ck3
 lQUUffXatGN3usKVztnINKpJlpgR4jAF+mJVlyZSKrucemUgaUkHAEzLT4bOabGlOc5m
 LU0qsCWgTkOCYfgoG19QTpi30U1p3vsAQWVSDbwL0hkzDxeP4aniEHyu9YhXlcRpjf+o
 c5Uw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712575298; x=1713180098;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=8qfTVCJvdgP5aRz71WIYHWHuEldQdJKe2Gxq57j5kDQ=;
 b=MTjSIQwyKlIKpuZMVxFj9HCutN5LZ2wVnYGLkoDiNhmlsQFxUa4q65TB4wffKrTrzO
 ZTFKsZ1Pl+qeGD9JwdZPGH6XSAyY+KfycFmTt8PXi71z13W9iOnJRruWTNUoQcTwRnYA
 5XEV0dZLSsT2RWTu6MhrcJ6giNEL/BgIzgiIV4z1+9MZuUtMCIl3tJMGhNdXR/Hs7nHB
 6BbARMSAwsCr3opLungmKbIjQKJDZoQXTl3xCM46VSre5HPj2R1y6vFnV/51MVIsAdF+
 ryZhb7xFuQQ2BzYBjYuC9S+gr5NAQWnx7hc3cwNkN/qkOIhsHsE2lFKVHbM3ZXzPKadE
 6I4A==
X-Gm-Message-State: AOJu0Ywld7uQClNCPwOnUbXiHTk4x9mCEGLybxq1QzRO6z1aZ1a4CnDq
 n4xGSJRfA5pmtVOPD+O7/SApJikcak63EjePcAQRWu9JmH6hEenAopM+86RVrvoW0qyx3mfO9ll
 HIcGGlvVzDRKXU3YQbDqy976q5mg=
X-Google-Smtp-Source: AGHT+IE1DBV9FHzlk4pJiJuhv+pbkrcPhwT2/eyDDZxWbNGMyQwrqoQmbHuUgJL56Ib+uhqRASUn7iQXzcInF+Oauc0=
X-Received: by 2002:a05:6602:4149:b0:7d5:ed33:d3e7 with SMTP id
 bv9-20020a056602414900b007d5ed33d3e7mr1851108iob.8.1712575298495; Mon, 08 Apr
 2024 04:21:38 -0700 (PDT)
MIME-Version: 1.0
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <m2msqafg97.fsf@HIDDEN>
 <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
 <m2o7aq3yxg.fsf@HIDDEN>
In-Reply-To: <m2o7aq3yxg.fsf@HIDDEN>
From: Paul Nelson <ultrono@HIDDEN>
Date: Mon, 8 Apr 2024 13:21:26 +0200
Message-ID: <CAOA-32Mop0U9fM6b4rjDbfMZQt7sDDark9rMQvtagDS6PQvVEw@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
To: Arash Esbati <arash@HIDDEN>
Content-Type: multipart/mixed; boundary="00000000000051812306159402fb"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000051812306159402fb
Content-Type: text/plain; charset="UTF-8"

Hi Arash,

OK, very well.  Please find attached my best attempt at a patch for
this (any feedback or corrections welcome).

Thanks, best,

Paul

--00000000000051812306159402fb
Content-Type: application/x-patch; 
	name="0001-fix-bug-with-preview-region-applied-to-repeated-math.patch"
Content-Disposition: attachment; 
	filename="0001-fix-bug-with-preview-region-applied-to-repeated-math.patch"
Content-Transfer-Encoding: base64
Content-ID: <f_luquttzy0>
X-Attachment-Id: f_luquttzy0

RnJvbSA5ZDMyNjYzMDRmNjJmYTNiMjE3NTFiMjcyMDBhYWIxNzQ1NGFkZDZjIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIE5lbHNvbiA8dWx0cm9ub0BnbWFpbC5jb20+CkRhdGU6
IE1vbiwgOCBBcHIgMjAyNCAxMzoxMTo1MiArMDIwMApTdWJqZWN0OiBbUEFUQ0hdIGZpeCBidWcg
d2l0aCBwcmV2aWV3LXJlZ2lvbiBhcHBsaWVkIHRvIHJlcGVhdGVkIG1hdGgKIGVudmlyb25tZW50
cwoKU2VlIGh0dHBzOi8vd3d3Lm1haWwtYXJjaGl2ZS5jb20vYnVnLWF1Y3RleEBnbnUub3JnL21z
ZzA0MzI3Lmh0bWwuCi0tLQogcHJldmlldy5lbC5pbiB8IDExICsrKysrKysrKysrCiAxIGZpbGUg
Y2hhbmdlZCwgMTEgaW5zZXJ0aW9ucygrKQoKZGlmZiAtLWdpdCBhL3ByZXZpZXcuZWwuaW4gYi9w
cmV2aWV3LmVsLmluCmluZGV4IDA5ODM2ZDkuLjcyYzVlNTggMTAwNjQ0Ci0tLSBhL3ByZXZpZXcu
ZWwuaW4KKysrIGIvcHJldmlldy5lbC5pbgpAQCAtMzI2OCw2ICszMjY4LDggQEAgUmV0dXJuIGEg
bmV3IHN0cmluZy4iCiAgICAgKHNldHEgcmVzdWx0IChjb25jYXQgcmVzdWx0IHN0cmluZykpCiAg
ICAgcmVzdWx0KSkKIAorKGRlZnZhci1sb2NhbCBwcmV2aWV3LS1yZWdpb24tYmVnaW4gbmlsKQor
CiAoZGVmdW4gcHJldmlldy1wYXJzZS1tZXNzYWdlcyAob3Blbi1jbG9zdXJlKQogICAiVHVybiBh
bGwgcHJldmlldyBzbmlwcGV0cyBpbnRvIG92ZXJsYXlzLgogVGhpcyBwYXJzZXMgdGhlIHBzZXVk
byBlcnJvciBtZXNzYWdlcyBmcm9tIHRoZSBwcmV2aWV3CkBAIC0zNTM4LDYgKzM1NDAsMTQgQEAg
bmFtZShcXChbXildK1xcKSlcXClcXHxcCiAgICAgICAgICAgICAgICAgICAgICAgICAoZ290by1j
aGFyIChwb2ludC1taW4pKQogICAgICAgICAgICAgICAgICAgICAgICAgKGZvcndhcmQtbGluZSAo
MS0gbGluZSkpKQogICAgICAgICAgICAgICAgICAgICAgIChzZXRxIGxwb2ludCAocG9pbnQpKQor
CisgICAgICAgICAgICAgICAgICAgICAgOzsgVGhlIGZvbGxvd2luZyBhZGRyZXNzZXMgdGhlIGJ1
ZyBkZXNjcmliZWQgYXQKKyAgICAgICAgICAgICAgICAgICAgICA7OyBodHRwczovL3d3dy5tYWls
LWFyY2hpdmUuY29tL2J1Zy1hdWN0ZXhAZ251Lm9yZy9tc2cwNDMyNy5odG1sCisgICAgICAgICAg
ICAgICAgICAgICAgKGFuZCBwcmV2aWV3LS1yZWdpb24tYmVnaW4KKyAgICAgICAgICAgICAgICAg
ICAgICAgICAgICg8IChwb2ludCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZp
ZXctLXJlZ2lvbi1iZWdpbikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChnb3RvLWNoYXIg
cHJldmlldy0tcmVnaW9uLWJlZ2luKSkKKwogICAgICAgICAgICAgICAgICAgICAgIChjb25kCiAg
ICAgICAgICAgICAgICAgICAgICAgICgoc2VhcmNoLWZvcndhcmQgKGNvbmNhdCBzdHJpbmcgYWZ0
ZXItc3RyaW5nKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChsaW5l
LWVuZC1wb3NpdGlvbikgdCkKQEAgLTQwMzMsNiArNDA0Myw3IEBAIHN0b3JlZCBpbiBgcHJldmll
dy1kdW1wZWQtYWxpc3QnLiIKICAgICAgICAgICAgICAgICAgICAgICAgICAiPG5vbmU+IikKICAg
ICAgICAgICAgICAgICAgICAgICAgKFRlWC1jdXJyZW50LW9mZnNldCBiZWdpbikpKQogICAoc2V0
cSBUZVgtY3VycmVudC1wcm9jZXNzLXJlZ2lvbi1wIHQpCisgIChzZXRxLWxvY2FsIHByZXZpZXct
LXJlZ2lvbi1iZWdpbiBiZWdpbikKICAgKHByZXZpZXctZ2VuZXJhdGUtcHJldmlldyAoVGVYLXJl
Z2lvbi1maWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwcmV2aWV3LWRvLXJlcGxh
Y2VtZW50cwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoVGVYLWNvbW1hbmQtZXhwYW5k
Ci0tIAoyLjM5LjMgKEFwcGxlIEdpdC0xNDUpCgo=
--00000000000051812306159402fb--




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 3 Apr 2024 21:43:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 03 17:43:27 2024
Received: from localhost ([127.0.0.1]:59830 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rs8OD-0001VV-TL
	for submit <at> debbugs.gnu.org; Wed, 03 Apr 2024 17:43:27 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40924)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1rs8O8-0001V4-Qd
 for 62445 <at> debbugs.gnu.org; Wed, 03 Apr 2024 17:43:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arash@HIDDEN>)
 id 1rs8Ny-0005Sc-PO; Wed, 03 Apr 2024 17:43:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=ImTKu8ZXUzDsPwzNNPZNGXtLVoX7ig6RV3bc+KlOgho=; b=mrzARm0CIMg9POy1huvA
 jKNqA1RJ0H6t2OZjPOGaBbSBg0WBl0Cx5jZtbL1SwFNb7aCpLFpClz75svgI087ESJ4TxoCCMg3dt
 UTtrEHtGEa2eusevFc3zXJSWNNtTXC0dQyAmuPZLxGvY3GCQrjMc6bOm7OdvlUVclUioiCW4pl/Nd
 9fOYhTCpT23PpKRuKiUBglV1BNZNkz3F83kpvTCEcLz6+UZ0mCNC/14rHPmvCOQPmhEY9R6FZTvdx
 KFHoUDgFzNvtvk67P/c7mqXjrOwuk/HLr4XsdpaebN4lVrrwrdMoi5+0vxQCRt2fuHJCVxLl97J49
 TRV4wDtjJw8KxA==;
From: Arash Esbati <arash@HIDDEN>
To: Paul Nelson <ultrono@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
In-Reply-To: <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
 (Paul Nelson's message of "Wed, 3 Apr 2024 22:22:58 +0200")
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <m2msqafg97.fsf@HIDDEN>
 <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
Date: Wed, 03 Apr 2024 23:43:07 +0200
Message-ID: <m2o7aq3yxg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Paul,

Paul Nelson <ultrono@HIDDEN> writes:

> I'll be happy to provide a patch for this.

That's a good start :-)

> Before doing so, let me clarify my motivation and ask for some advice.
> I (and at least 6 others) have been using the package
> https://github.com/ultronozm/czm-preview.el, which implements this fix
> together with some other features.

Yes, I noticed you were working on different lisp libraries around TeX =F0=
=9F=91=8D

> The implementation relies on 10 pieces of advice applied to preview-*
> and TeX-* functions.  I'd like to eliminate the use of advice, so that
> the package is less brittle.  Fixing this bug would be one step
> towards that goal; the others would involve adding hooks and
> customization options to preview.el (without modifying its current
> operation -- I don't want to introduce instability).

This is definitely important.  You may have noticed that the general
author of preview is now inactive, and the library is in sort of
maintenance mode, so we have to be careful.=20

> Thus, to create this patch, I'll isolate the relevant modifications
> from my overridden versions of preview-region and
> preview-parse-messages.  Later, in a separate report, I'll ask for
> some (e.g.) hooks to be added to the same functions.  If those changes
> make it into an AUCTeX release, then I'll be able to eliminate some
> advice from my package.
>
> Does this sound like a reasonable plan?  Any other suggestions?

It sounds like a plan; gradually bringing in stuff you need is the way
to go.  Looking forward to your changes.

Best, Arash




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 3 Apr 2024 20:23:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 03 16:23:23 2024
Received: from localhost ([127.0.0.1]:59748 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rs78k-0002F2-N8
	for submit <at> debbugs.gnu.org; Wed, 03 Apr 2024 16:23:22 -0400
Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:46327)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ultrono@HIDDEN>) id 1rs78h-0002E6-VD
 for 62445 <at> debbugs.gnu.org; Wed, 03 Apr 2024 16:23:21 -0400
Received: by mail-il1-x134.google.com with SMTP id
 e9e14a558f8ab-368cd5ddb65so1012965ab.0
 for <62445 <at> debbugs.gnu.org>; Wed, 03 Apr 2024 13:23:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1712175789; x=1712780589; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=NyfPMMcXY/5WwcXSXW9sRVPR39cFAvatVZ7upkO60ak=;
 b=fTvLyHsnMH+CNl32vB6KTYdTGT8i5Ptivd1sdU5V/V2MtUNEFal1GwCwWYa4acyUCG
 RGOaSfqixKaTI4k/IK0qMKdrJhgn6rNndkT244iZ3W7VCxfEmOcorqgEodd/1lisbUy5
 pOszhBzXNGExeOMWMUUbJGPbsgBvxlnIihGrJLcz9YDtEczI2lxH54tVEYle3t1cQYhY
 tMlwRMM72OcydNOSOfDxNmv5OEleLlhzneBKvmGdt+XPlnpsndMX5yHmm1L/IsDG7ytW
 Mo8q5lXERnMV9wT3y24J6+tMZCO7wmKxeeA5dsuDP/Y+QB6hs1Bev7HOCJ9+iIg/eOQL
 nOtA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1712175789; x=1712780589;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=NyfPMMcXY/5WwcXSXW9sRVPR39cFAvatVZ7upkO60ak=;
 b=lO4dTX1KGzne924MuQpZECzv4UsKum4uafw1fu0uTql6+BCWnimkejPVjAn2FNalx1
 CYZ7ne6D9304+eYrxWvIHlJNVj3lvYLZllHLOxCf82b7AygGsBfElK/Ts4zsdIrYcmXX
 VOMlYpO7ze2btW2wRtpHYl5XcPgDcng9UP/ZLwUOXJkWP2WA60ytwHOTNPlooZ5zvwEY
 WH2Eo6imOpnaZt0dOqGUX9jMVxlIQWU59LKdzV5HqvUviIsZ3yQwfrgjFzXWURHqbTZ8
 Cdvz8pW9suRkyCxEXcNNF4iKMhYWjeIH/Rnh6ZyKqplGHE63jLMPY7UApovD+xAexlVX
 KNkQ==
X-Gm-Message-State: AOJu0Yxjn8ZjzXeqpm58fH2Eq2INH9BODC7TCrtVkiqU7I4+kW3EUv17
 t2eoRzi7RSjyLQn4f3CsZiaW7HtJnHomlK3cI4/FAArAr+oIQaY5vlv6eR6B8XGx/lv9di//M8H
 96Bm/qOYmvcmGVqrtIVzmc1OGFew=
X-Google-Smtp-Source: AGHT+IF0GalFhjNzvndF/QZI+fXc7uuWwPplLcxgJYkM7roqlyOvTTsgRy3dw0G6tm/ZGgutiqzb37xIHXXABlUmia8=
X-Received: by 2002:a05:6e02:3683:b0:365:bff:adfa with SMTP id
 cj3-20020a056e02368300b003650bffadfamr970070ilb.17.1712175789463; Wed, 03 Apr
 2024 13:23:09 -0700 (PDT)
MIME-Version: 1.0
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <m2msqafg97.fsf@HIDDEN>
In-Reply-To: <m2msqafg97.fsf@HIDDEN>
From: Paul Nelson <ultrono@HIDDEN>
Date: Wed, 3 Apr 2024 22:22:58 +0200
Message-ID: <CAOA-32P6dUG8yVMopah1A=ztg8-j7J85M1B+fFn-20v9PJgX+A@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
To: Arash Esbati <arash@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Arash,

I'll be happy to provide a patch for this.

Before doing so, let me clarify my motivation and ask for some advice.
I (and at least 6 others) have been using the package
https://github.com/ultronozm/czm-preview.el, which implements this fix
together with some other features.  The implementation relies on 10
pieces of advice applied to preview-* and TeX-* functions.  I'd like
to eliminate the use of advice, so that the package is less brittle.
Fixing this bug would be one step towards that goal; the others would
involve adding hooks and customization options to preview.el (without
modifying its current operation -- I don't want to introduce
instability).

Thus, to create this patch, I'll isolate the relevant modifications
from my overridden versions of preview-region and
preview-parse-messages.  Later, in a separate report, I'll ask for
some (e.g.) hooks to be added to the same functions.  If those changes
make it into an AUCTeX release, then I'll be able to eliminate some
advice from my package.

Does this sound like a reasonable plan?  Any other suggestions?

Thanks, best,

Paul




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 3 Apr 2024 18:33:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 03 14:33:40 2024
Received: from localhost ([127.0.0.1]:59579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rs5QZ-0001ne-2U
	for submit <at> debbugs.gnu.org; Wed, 03 Apr 2024 14:33:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35680)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1rs5QW-0001mz-FG
 for 62445 <at> debbugs.gnu.org; Wed, 03 Apr 2024 14:33:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arash@HIDDEN>)
 id 1rs5QM-0007Jj-L1; Wed, 03 Apr 2024 14:33:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=XzbOToCgseP5Sl8yAg0btph8/jQSY9vrCnxI7JlqXcc=; b=MxqSRgOfAmWejfpl3A9O
 W1FmEObn9WKhJ/cCxBMOfkCWHSy2mRlLDDPEuR8F6dphF/Z1g0B9o8ocT0wkVRP9uggH8KOmU6ac0
 ZnEH9Q7GpWu/5iMfMiY66JiHLekKkXQAqi7YuLMc4INsonCmgpf06GWUxErs1T821qB3oBrWygvGl
 TUBcsDG6j1rrk7uN5lwivRKgH9cDi/yCTxV2JMnxFkvlPH7XQlCTLmS1IQ3RBqShyZkXnVEYluhTe
 aBp1PirWz+u4rgjMjuDrs4YOBAQo8RaXPbS4E943jZYXpkxKCSk+TuUq8oct5QHNFkRIXtKerGp5W
 VgTmwywS3QMrTQ==;
From: Arash Esbati <arash@HIDDEN>
To: Paul Nelson <ultrono@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
In-Reply-To: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 (Paul Nelson's message of "Sat, 25 Mar 2023 17:14:48 +0100")
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
Date: Wed, 03 Apr 2024 20:33:24 +0200
Message-ID: <m2msqafg97.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Paul Nelson <ultrono@HIDDEN> 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




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 25 Mar 2023 16:46:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 25 12:46:13 2023
Received: from localhost ([127.0.0.1]:43338 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pg71w-00042A-9z
	for submit <at> debbugs.gnu.org; Sat, 25 Mar 2023 12:46:12 -0400
Received: from mail-qk1-f179.google.com ([209.85.222.179]:36379)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ultrono@HIDDEN>) id 1pg71u-00041l-AY
 for 62445 <at> debbugs.gnu.org; Sat, 25 Mar 2023 12:46:11 -0400
Received: by mail-qk1-f179.google.com with SMTP id q2so1332553qki.3
 for <62445 <at> debbugs.gnu.org>; Sat, 25 Mar 2023 09:46:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679762764;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=SE8WPAVmsvXFIEilAwVlQaMFGYocSb0fximViLmPJto=;
 b=CsJtAnNr65KG3YL3Su5kxZw+PBxM5Rb9corDokmZTOpu56DMBuAzkbIE4Qjm33KbkF
 JI5NPDFHs4/xynf5QwxHV5ECfugQzAzoOaBtiXDJuw8LmnYe/UF56GyUBuMaG+QMbiHH
 M09yzkoJpICEZB73AIoOzrt9nED4yySJcCPkmQhM6OUEeZ7NNaUxm70K9HBAu4yZk8ID
 MjPiPVE5i7JXmR5rxWW222vzI8SNGTOSA0usGOfu9rJ4SE6bWhkRXT/sF5KmPsknn6cb
 6PyjeiC2FmHIkGbl+ZrfO2xs8J0nvY5aI3uFqKkS0tkDgWpWvEMK6IFHWvkxt7oTjcoO
 2ZEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679762764;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=SE8WPAVmsvXFIEilAwVlQaMFGYocSb0fximViLmPJto=;
 b=Op83NilF5pqNK9yr335udGGtbnHmgByouJXeuBqKjkI8GHJb2ptbszh4B3BU8vp3fl
 97Ie4zo0wKxuqgwboj1UJJeCz+Gcewijb97DGqfQxmTxf+TwM7HgU50Kjj50b9Sg/J/S
 db6V533EZJFTrBEKMiLtTxsXwOTZqxJP+JlOWqP8OXnoP08iAaEYtgL2v94z7CVwIZ2a
 Tkp7Yar604kbMZrrIzmw06nIkbGA4zzhu77xfZA1OSGZ67Wb5BtHw/RimkdxVRPVqlc2
 M7wWtx5Snj/OcxEzABGHmd3OrY7JChJnOYIvYbfmZygupYC2CgwT2Xqy3G2A5I/4L/bX
 iymQ==
X-Gm-Message-State: AO0yUKV6CdxxiRuAkKfbVvm9lTBUlG5p6YOie00ZI0t8KR+lGKMGN+Gs
 YeueV3c2lF0cHSpK1fM5hS8n0CyATIwa4HeSEIi9jxUF/Uw=
X-Google-Smtp-Source: AK7set+O2ipGcjlA9wsngQBRH97njZJ2hhA9d0kY2i5kwlHl0Lo+o7n5IeMenDyNm2NoIMNcgXNW+ho0crXbFuimUyo=
X-Received: by 2002:a05:620a:178d:b0:742:9e15:3e0 with SMTP id
 ay13-20020a05620a178d00b007429e1503e0mr1629947qkb.5.1679762764420; Sat, 25
 Mar 2023 09:46:04 -0700 (PDT)
MIME-Version: 1.0
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 <87h6u8lr6p.fsf@HIDDEN>
In-Reply-To: <87h6u8lr6p.fsf@HIDDEN>
From: Paul Nelson <ultrono@HIDDEN>
Date: Sat, 25 Mar 2023 17:45:52 +0100
Message-ID: <CAOA-32O29CDUVoaRQfCjETLy5fvVNQz6VnFYBkp8LdVgjGG7QQ@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
To: David Kastrup <dak@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000e159d805f7bc3eea"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000e159d805f7bc3eea
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks for your response.  Here is my complete *_region_ output* for the
example I described.  -file-line-error already seems to be included.
Please let me know if I missed something.

Running `Preview-LaTeX' on `~/doit/_region_' with ``pdflatex
 -file-line-error   --synctex=3D1
"\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview=
}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,float=
s,graphics,textmath,sections,footnotes,showlabels]{preview}[2004/11/05]\fi}=
"
"\input" "\detokenize{" _region_.tex "}"''
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded
format=3Dpdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
No auxiliary output files.

(./_region_.tex  !name(test.tex)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amscls/amsart.cls
Document Class: amsart 2017/10/31 v2.20.4
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.d=
ef)
No file _region_.aux.
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/preview.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/luatex85/luatex85.sty)
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prtightpage.def)
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prauctex.def
No auxiliary output files.


(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prauctex.cfg))
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prfootnotes.def)
(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prshowlabels.def)
Preview: Fontsize 10pt
Preview: PDFoutput 1
) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsb.fd)
 !name(test.tex) !offset(-2)
./_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$

[1{/usr/local/texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
 !name(test.tex) !offset(-4)
\newlabel{tocindent-1}{0pt}
\newlabel{tocindent0}{0pt}
\newlabel{tocindent1}{0pt}
\newlabel{tocindent2}{0pt}
\newlabel{tocindent3}{0pt}
 )
(see the transcript file for additional
information)</usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfonts=
/cm/cmmi10.pfb>
Output written on _region_.pdf (1 page, 8292 bytes).
SyncTeX written on _region_.synctex.gz.
Transcript written on _region_.log.

TeX Output exited as expected with code 1 at Sat Mar 25 17:42:58
Running `Preview-PDF2DSC' with ``pdf2dsc _region_.pdf
_region_.prv/tmpAnnFJy/preview.dsc''

Preview-PDF2DSC finished at Sat Mar 25 17:42:58
Running `Preview-Ghostscript' with ``/usr/local/bin/gs
-sOutputFile\=3D_region_.prv/tmpAnnFJy/pr1-\%d.pbm -q -dNOPAUSE -dNOSAFER
-DNOPLATFONTS -dPrinted -dTextAlphaBits\=3D4 -dGraphicsAlphaBits\=3D4
-sDEVICE\=3Dpnmraw -r238.169x239.282''

Preview-Ghostscript finished at Sat Mar 25 17:42:58

On Sat, Mar 25, 2023 at 5:41=E2=80=AFPM David Kastrup <dak@HIDDEN> wrote:

> Paul Nelson <ultrono@HIDDEN> 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
>

--000000000000e159d805f7bc3eea
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks for your response.=C2=A0 Here is my complete *_regi=
on_ output* for the example I described.=C2=A0 -file-line-error already see=
ms to be included.=C2=A0 Please let me know if I missed something.<div></di=
v><div><br></div><div>Running `Preview-LaTeX&#39; on `~/doit/_region_&#39; =
with ``pdflatex =C2=A0-file-line-error =C2=A0 --synctex=3D1 &quot;\nonstopm=
ode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginD=
ocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics=
,textmath,sections,footnotes,showlabels]{preview}[2004/11/05]\fi}&quot; &qu=
ot;\input&quot; &quot;\detokenize{&quot; _region_.tex &quot;}&quot;&#39;&#3=
9;<br>This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (prelo=
aded format=3Dpdflatex)<br>=C2=A0restricted \write18 enabled.<br>entering e=
xtended mode<br>LaTeX2e &lt;2020-02-02&gt; patch level 5<br>L3 programming =
layer &lt;2020-03-06&gt;<br>No auxiliary output files.<br><br>(./_region_.t=
ex =C2=A0!name(test.tex) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsc=
ls/amsart.cls<br>Document Class: amsart 2017/10/31 v2.20.4<br>(/usr/local/t=
exlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty<br>For additional info=
rmation on amsmath, use the `?&#39; option.<br>(/usr/local/texlive/2020/tex=
mf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2020/texmf-dist/t=
ex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex=
/amsmath/amsbsy.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/=
amsopn.sty)) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd=
) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/u=
sr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)=
<br>No file _region_.aux.<br>(/Users/paulnelson/.emacs.d/elpa/auctex-13.1.1=
0/latex/preview.sty (/usr/local/texlive/2020/texmf-dist/tex/generic/luatex8=
5/luatex85.sty) (/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prtig=
htpage.def) (/Users/paulnelson/.emacs.d/elpa/auctex-13.1.10/latex/prauctex.=
def<br>No auxiliary output files.<br><br><br>(/Users/paulnelson/.emacs.d/el=
pa/auctex-13.1.10/latex/prauctex.cfg)) (/Users/paulnelson/.emacs.d/elpa/auc=
tex-13.1.10/latex/prfootnotes.def) (/Users/paulnelson/.emacs.d/elpa/auctex-=
13.1.10/latex/prshowlabels.def)<br>Preview: Fontsize 10pt<br>Preview: PDFou=
tput 1<br>) (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)=
 (/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsb.fd) =C2=A0!nam=
e(test.tex) !offset(-2) <br>./_region_.tex:5: Preview: Snippet 1 started.<b=
r>&lt;-&gt;&lt;-&gt;<br>=C2=A0 =C2=A0 =C2=A0 <br>l.5 $<br>=C2=A0 =C2=A0 =C2=
=A0x$<br>Preview: Tightpage -32891 -32891 32891 32891<br>./_region_.tex:5: =
Preview: Snippet 1 ended.(282168+0x374556).<br>&lt;-&gt;&lt;-&gt;<br>=C2=A0=
 =C2=A0 =C2=A0 <br>l.5 $x$<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0<br>[1{/usr/local/=
texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] =C2=A0!name(tes=
t.tex) !offset(-4) <br>\newlabel{tocindent-1}{0pt}<br>\newlabel{tocindent0}=
{0pt}<br>\newlabel{tocindent1}{0pt}<br>\newlabel{tocindent2}{0pt}<br>\newla=
bel{tocindent3}{0pt}<br>=C2=A0)<br>(see the transcript file for additional =
information)&lt;/usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfo=
nts/cm/cmmi10.pfb&gt;<br>Output written on _region_.pdf (1 page, 8292 bytes=
).<br>SyncTeX written on _region_.synctex.gz.<br>Transcript written on _reg=
ion_.log.<br><br>TeX Output exited as expected with code 1 at Sat Mar 25 17=
:42:58<br>Running `Preview-PDF2DSC&#39; with ``pdf2dsc _region_.pdf _region=
_.prv/tmpAnnFJy/preview.dsc&#39;&#39;<br><br>Preview-PDF2DSC finished at Sa=
t Mar 25 17:42:58<br>Running `Preview-Ghostscript&#39; with ``/usr/local/bi=
n/gs -sOutputFile\=3D_region_.prv/tmpAnnFJy/pr1-\%d.pbm -q -dNOPAUSE -dNOSA=
FER -DNOPLATFONTS -dPrinted -dTextAlphaBits\=3D4 -dGraphicsAlphaBits\=3D4 -=
sDEVICE\=3Dpnmraw -r238.169x239.282&#39;&#39;<br><br>Preview-Ghostscript fi=
nished at Sat Mar 25 17:42:58<br></div></div><br><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Mar 25, 2023 at 5:41=E2=80=
=AFPM David Kastrup &lt;<a href=3D"mailto:dak@HIDDEN">dak@HIDDEN</a>&gt; =
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Paul Nels=
on &lt;<a href=3D"mailto:ultrono@HIDDEN" target=3D"_blank">ultrono@gmail=
.com</a>&gt; writes:<br>
<br>
&gt; Emacs=C2=A0 : GNU Emacs 29.0.50 (build 3, x86_64-apple-darwin21.6.0, N=
S<br>
&gt; appkit-2113.60 Version 12.6 (Build 21G115))<br>
&gt;=C2=A0 of 2022-11-06<br>
&gt; Package: 13.1.10<br>
&gt;<br>
&gt; Take the following document:<br>
&gt;<br>
&gt; #+begin_src latex<br>
&gt; \documentclass{amsart}<br>
&gt; \begin{document}<br>
&gt;=C2=A0 $x$ $x$<br>
&gt; \end{document}<br>
&gt; #+end_src<br>
&gt;<br>
&gt;<br>
&gt; Run ~preview-region~ on the region consisting of the first $x$.=C2=A0 =
This works<br>
&gt; as expected.<br>
&gt;<br>
&gt; Next, run ~preview-region~ on the region consisting of just the second=
<br>
&gt; $x$.=C2=A0 This does not preview the second $x$.=C2=A0 Instead, it ref=
reshes the<br>
&gt; overlay on the first $x$.<br>
&gt;<br>
&gt; The relevant output:<br>
&gt;<br>
&gt; #+begin_quote<br>
&gt; ./_region_.tex:5: Preview: Snippet 1 started.<br>
&gt; &lt;-&gt;&lt;-&gt;<br>
&gt;<br>
&gt; l.5 $<br>
&gt;=C2=A0 =C2=A0 =C2=A0 x$<br>
&gt; Preview: Tightpage -32891 -32891 32891 32891<br>
&gt; ./_region_.tex:5: Preview: Snippet 1 ended.(282168+0x374556).<br>
&gt; &lt;-&gt;&lt;-&gt;<br>
&gt;<br>
&gt; l.5 $x$<br>
&gt;<br>
&gt; #+end_quote<br>
&gt;<br>
&gt;<br>
&gt; The issue here is that there&#39;s not enough context for<br>
&gt; ~preview-parse-messages~ to determine which $x$ to overlay.<br>
<br>
I&#39;d just add -file-line-error to the options you are calling TeX with.<=
br>
That makes for more reliable error message interpretation.<br>
<br>
-- <br>
David Kastrup<br>
</blockquote></div>

--000000000000e159d805f7bc3eea--




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at 62445 <at> debbugs.gnu.org:


Received: (at 62445) by debbugs.gnu.org; 25 Mar 2023 16:41:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 25 12:41:39 2023
Received: from localhost ([127.0.0.1]:43333 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pg6xT-0003tc-13
	for submit <at> debbugs.gnu.org; Sat, 25 Mar 2023 12:41:39 -0400
Received: from [209.51.188.92] (port=39382 helo=eggs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dak@HIDDEN>) id 1pg6xN-0003tC-3q
 for 62445 <at> debbugs.gnu.org; Sat, 25 Mar 2023 12:41:33 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dak@HIDDEN>)
 id 1pg6x9-0001lg-SQ; Sat, 25 Mar 2023 12:41:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=nZ87OYga/0hoh1+otHgAbooVLL7tuKWcWL1wqWKKhjw=; b=nZrHR+oC4DRV6/IHsWr/
 ueeD95QiEr9dvlsu66DXw4xc9vuV7VVzPrGyqIuPv4BSD3rUJuKzeq1UQoQ9zh/gjgtuRffDfc8Ff
 CRWm+4U9gUUAnJdCr14GSB7MT8SD214UwmQk/HQL1EM7lCdysb1Y1b7C/1gRLdFRCus4dP7tLIFOe
 +vGznxRS9wMN7V0vBdFYQanb7WyyffxBDXRkGSyH/JV7ItKaT7/W5r8mBUZi+qmFJISwwUIEzgOrH
 GDlG5TqGR0llniSWzDUeeafs2YLInYoxzO5DZedAB5QzAIi7HC/36hsYzn6qaRVySrvK0/DOEmFlw
 tgClciCnu0LAQA==;
Received: from dynamic-078-049-004-142.78.49.pool.telefonica.de ([78.49.4.142]
 helo=lola)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dak@HIDDEN>)
 id 1pg6x7-0006zD-Aj; Sat, 25 Mar 2023 12:41:13 -0400
From: David Kastrup <dak@HIDDEN>
To: Paul Nelson <ultrono@HIDDEN>
Subject: Re: bug#62445: 13.1.10; bug in preview-region applied to repeated
 math environments
In-Reply-To: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
 (Paul Nelson's message of "Sat, 25 Mar 2023 17:14:48 +0100")
References: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
Date: Sat, 25 Mar 2023 17:41:02 +0100
Message-ID: <87h6u8lr6p.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 62445
Cc: 62445 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.0 (--)

Paul Nelson <ultrono@HIDDEN> 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




Information forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Mar 2023 16:15:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 25 12:15:07 2023
Received: from localhost ([127.0.0.1]:43302 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pg6Xq-00035J-Ge
	for submit <at> debbugs.gnu.org; Sat, 25 Mar 2023 12:15:07 -0400
Received: from lists.gnu.org ([209.51.188.17]:47478)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ultrono@HIDDEN>) id 1pg6Xo-000359-Oj
 for submit <at> debbugs.gnu.org; Sat, 25 Mar 2023 12:15:05 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ultrono@HIDDEN>) id 1pg6Xo-0001TF-A1
 for bug-auctex@HIDDEN; Sat, 25 Mar 2023 12:15:04 -0400
Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ultrono@HIDDEN>) id 1pg6Xm-0000HA-DP
 for bug-auctex@HIDDEN; Sat, 25 Mar 2023 12:15:04 -0400
Received: by mail-qk1-x733.google.com with SMTP id o82so1311752qka.11
 for <bug-auctex@HIDDEN>; Sat, 25 Mar 2023 09:15:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20210112; t=1679760900;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=oR23v2nLRczpC5td1mkDLtBQN4CfteWV7zKJg0Yz/YQ=;
 b=SC8arunPX2HwiKy92CUZAaYoHea0NZvVrvFHOt7BeYXKJVRGwxWUfMZWkJX/Igsia/
 XrLV0yiauIq5CVmy87xh2EM2m1UxOvX/w8bwG9Dmkws+4fi61hMLlMvk8yZmHcPCfOey
 LF4ODFj9XEcVTurKq0PjXDgp/ZkPepqUCrVP65ZaRf/xrGgDNR8bLWKMTeNYid0eDsh/
 pvImG0diH//Z/ZTY4aOhnMFW1rNdnlusDKTbesPO6/8muymI/EoDtdFSfhgT5OWGinC3
 UT1FfoLiLGgWrtzquf/CWK++PJhjJpjURQdOV5UAeoKF9Tw1ovvAFXz2gdwfCqxI6AQc
 cF2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679760900;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=oR23v2nLRczpC5td1mkDLtBQN4CfteWV7zKJg0Yz/YQ=;
 b=pZKo6fYe2S6RrB5V48aoobHT4wlD2CuFqRAkaRhEAVY+IHQ5Q4PhtZ7JzWU7c0CvSX
 Sr7+dZV/qVCAxt4LPTKdHkT5BP3Kjjv4pRpS/IZ2/FE2+rcAE/jaXyWmwnayI0ysppdD
 a7IsZgg/NnVdBxJcjE/O8sn2ID77JmuHbVlq0IiwK5nFZ7pbDZDzVU/XhB265Vx21Gta
 PPGircrgTpP0O1mWlQGfeWO7fsjtdGrv/n6fyUsk8d6S9acH8hY/TTKdvQAufIAuppF2
 Tw+zfIL54ae2AEtC8MqhaLuUJZ/t+JoaYJIuyBN/+1uxsLPmWp2xnCo9oDnvERklsnmD
 mBAw==
X-Gm-Message-State: AO0yUKXa5cvAmONvoYHAPywB3gJTvZCG+0fKX6Q18ySWEGSwkQ03z+nA
 0CUDEWXLikU33rtam7iGBLN4bn4cxbxHLGpV4Vi1igbuVUo=
X-Google-Smtp-Source: AK7set9orLQ+2Z2Ig37uJCACDwcrRkjKcLhyIk05rsPrsV7aM6/JwPSiw7fBRdIxYwxiA+nL/Wo+KbP5AEH/GIWnMyw=
X-Received: by 2002:a37:ef0e:0:b0:71f:b89c:5ac4 with SMTP id
 j14-20020a37ef0e000000b0071fb89c5ac4mr982640qkk.5.1679760899688; Sat, 25 Mar
 2023 09:14:59 -0700 (PDT)
MIME-Version: 1.0
From: Paul Nelson <ultrono@HIDDEN>
Date: Sat, 25 Mar 2023 17:14:48 +0100
Message-ID: <CAOA-32OT5u8cgYUT2qFDMiK3Sj9=JTsohiu62yswkj0SEatc-w@HIDDEN>
Subject: 13.1.10; bug in preview-region applied to repeated math environments
To: bug-auctex@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000bbcd5705f7bbcfb5"
Received-SPF: pass client-ip=2607:f8b0:4864:20::733;
 envelope-from=ultrono@HIDDEN; helo=mail-qk1-x733.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--000000000000bbcd5705f7bbcfb5
Content-Type: text/plain; charset="UTF-8"

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.

One workaround would be to apply ~preview-region~ to a region containing
both $x$'s (or to use ~preview-buffer~, etc).  This workaround wasn't ideal
for my use-case (see parenthetical comment at the bottom).

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.

(This bug was an issue for me because I had set up a timer that searches
the visible portion of a TeX buffer for unrendered math environments and
runs ~preview-region~ on contiguous unpreviewed blocks.  This led to many
situations where  ~preview-region~ was called on math regions, such as the
second $x$ in the above example, that had already been previewed in the
current line.  My original workaround was to enlarge the region sent to
~preview-region~ to contain any repeated math regions that appear earlier
in a given line.  This worked, but often resulted in many fragments getting
unnecessarily refreshed.)

--000000000000bbcd5705f7bbcfb5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Emacs =C2=A0: GNU Emacs 29.0.50 (build 3, x86_64-apple-dar=
win21.6.0, NS appkit-2113.60 Version 12.6 (Build 21G115))<br>=C2=A0of 2022-=
11-06<br>Package: 13.1.10<br><br>Take the following document:<br>=C2=A0 =C2=
=A0<br>#+begin_src latex<br>\documentclass{amsart}<br>\begin{document}<br>=
=C2=A0$x$ $x$<br>\end{document}<br>#+end_src<br><br>Run ~preview-region~ on=
 the region consisting of the first $x$.=C2=A0 This works as expected.<br><=
br>Next, run ~preview-region~ on the region consisting of just the second $=
x$.=C2=A0 This does not preview the second $x$.=C2=A0 Instead, it refreshes=
 the overlay on the first $x$.<br><br>The relevant output:<br><br>#+begin_q=
uote<br>./_region_.tex:5: Preview: Snippet 1 started.<br>&lt;-&gt;&lt;-&gt;=
<br>=C2=A0 =C2=A0 =C2=A0 <br>l.5 $<br>=C2=A0 =C2=A0 =C2=A0x$<br>Preview: Ti=
ghtpage -32891 -32891 32891 32891<br>./_region_.tex:5: Preview: Snippet 1 e=
nded.(282168+0x374556).<br>&lt;-&gt;&lt;-&gt;<br>=C2=A0 =C2=A0 =C2=A0 <br>l=
.5 $x$<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0<br>#+end_quote<br><br>The issue here =
is that there&#39;s not enough context for ~preview-parse-messages~ to dete=
rmine which $x$ to overlay.<br><br>One workaround would be to apply ~previe=
w-region~ to a region containing both $x$&#39;s (or to use ~preview-buffer~=
, etc).=C2=A0 This workaround wasn&#39;t ideal for my use-case (see parenth=
etical comment at the bottom).<br><br>I think a fix would be to store the b=
eginning of the region being previewed in a buffer-local variable and, if n=
eeded, bump the point when searching for where to place the overlay.=C2=A0 =
Details:<br><br>- Add the following line somewhere in preview.el:<br>=C2=A0=
 #+begin_src elisp<br>=C2=A0 (defvar-local preview-region--begin nil &quot;=
Start of region being processed.&quot;)<br>=C2=A0 #+end_src<br><br>- Add th=
e following line to ~preview-region~, just before the invocation of ~previe=
w-generate-preview~:<br>=C2=A0 #+begin_src elisp<br>=C2=A0 (setq-local prev=
iew-region--begin begin)<br>=C2=A0 #+end_src<br><br>- Add this to ~preview-=
parse-messages~, just before the second ~cond~ block:<br>=C2=A0 #+begin_src=
 elisp<br>=C2=A0 (when (&lt; (point) preview-region--begin)<br>=C2=A0 =C2=
=A0 (goto-char preview-region--begin))<br>=C2=A0 #+end_src<br><br>I&#39;ve =
made these changes in my local version and they have worked for me.<br><br>=
(This bug was an issue for me because I had set up a timer that searches th=
e visible portion of a TeX buffer for unrendered math environments and runs=
 ~preview-region~ on contiguous unpreviewed blocks.=C2=A0 This led to many =
situations where =C2=A0~preview-region~ was called on math regions, such as=
 the second $x$ in the above example, that had already been previewed in th=
e current line.=C2=A0 My original workaround was to enlarge the region sent=
 to ~preview-region~ to contain any repeated math regions that appear earli=
er in a given line.=C2=A0 This worked, but often resulted in many fragments=
 getting unnecessarily refreshed.)<br><div><br></div></div>

--000000000000bbcd5705f7bbcfb5--




Acknowledgement sent to Paul Nelson <ultrono@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-auctex@HIDDEN. Full text available.
Report forwarded to bug-auctex@HIDDEN:
bug#62445; Package auctex. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 8 Apr 2024 19:45:04 UTC

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