GNU logs - #78587, boring messages


Message sent to bug-auctex@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#78587: [PATCH] TeX-find-macro-end
Resent-From: "Paul D. Nelson" <ultrono@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-auctex@HIDDEN
Resent-Date: Sun, 25 May 2025 15:15:02 +0000
Resent-Message-ID: <handler.78587.B.174818610015559 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 78587
X-GNU-PR-Package: auctex
X-GNU-PR-Keywords: patch
To: 78587 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-auctex@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.174818610015559
          (code B ref -1); Sun, 25 May 2025 15:15:02 +0000
Received: (at submit) by debbugs.gnu.org; 25 May 2025 15:15:00 +0000
Received: from localhost ([127.0.0.1]:46744 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJD3z-00042t-Ss
	for submit <at> debbugs.gnu.org; Sun, 25 May 2025 11:15:00 -0400
Received: from lists.gnu.org ([2001:470:142::17]:51836)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ultrono@HIDDEN>) id 1uJD3w-00042M-L4
 for submit <at> debbugs.gnu.org; Sun, 25 May 2025 11:14:57 -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 1uJD3q-0003Wb-IR
 for bug-auctex@HIDDEN; Sun, 25 May 2025 11:14:50 -0400
Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ultrono@HIDDEN>) id 1uJD3o-0006Pe-R6
 for bug-auctex@HIDDEN; Sun, 25 May 2025 11:14:50 -0400
Received: by mail-ed1-x533.google.com with SMTP id
 4fb4d7f45d1cf-60410a9c6dcso2295585a12.1
 for <bug-auctex@HIDDEN>; Sun, 25 May 2025 08:14:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1748186087; x=1748790887; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=kgzou8plurF1P/cd7eHTHvAMPx4iUjdsrIMdhFV25Us=;
 b=bVThj0Uwvrei6m5Flsj67JHVcCGEKQHO9AsmvQepI6ni31GNX0gxVfGJ0XPijYUNSC
 7sKl4o6tU4Xl050sTEcAS6tT5SRVQ4ykCqHPSJb1okk+zwL9wmhLDOZ8d1sxUlXxxIvO
 c7wvddxe2njjEw2JhInk7xkRGCgwE5tGJUm9osGkIMGoENqwfShvZvdf+UAK947uW5G1
 UMmkTHnpN1BqzkFg9nb6D3dkE0WmNVdt/hWCpQNJM04zWic421/AfXmwlGLwCluS4Pw8
 oyhkKobzzRWdktotKsoy7Frnb6P1uhWLyQ+N/L2VBM88Tk1KSNYkphZX0kDZvxijVUlf
 OkKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1748186087; x=1748790887;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=kgzou8plurF1P/cd7eHTHvAMPx4iUjdsrIMdhFV25Us=;
 b=nb6t5ihPfS7Sivlqh089iTEziIYDg3Unr1Gej8EWYpBnFejrX7JpWjFeNfwHUjGfaT
 gnnIg+BLB2IQz9bxicKEfVPZb89HE93WHpSopg9/RBjQbNGK9kowg1zQkH5PrUPslnsV
 ngUbRhrRR9dpYT/E73kOqYfAkVu/uRBsmDkFkysoy9pkFloIJ4UwSwdrI+tHSqIkg3rl
 3KVv7EJQjHxZKsmZo1njiCQ2tclZmINV0Doptdc7EYX7ztr7YMW51dE6Sh1w3J2ur6wf
 j8ksHno6Eh1DT8XuHe3zOhEVvIrIe0r9HzQuqqK0AkLPPi5eOEP3SIxyXyjoQyovSBDy
 2i/g==
X-Gm-Message-State: AOJu0YzNcxfmXy1ifPtetMsM2Hc8yv311Ebgu2ZFrtEr0f3DIFpAZaej
 mw+t0ukPy0Q7Azac9cByUTmvjky/DXohvgR68EGh1iHGuiT/+nnoyW/0Sy6P5ZEe
X-Gm-Gg: ASbGncudHGp7PY8MYKxZzjaR9QSd7RVn8fawUHNknPv7uMUv1IPIxivm456zQg7gliX
 rbLdDlUvnfbNmiNBcBSCsIxYISpZcBKIjrF9W3H1GU3YDt5fbsGbLtSr7V/Aj/lvpSjMoWrY+kO
 GOZJ82H8Mit7UJKSl4EQ1uixPCTFZHpRhdyKp+opmmRoGHFP8bYhMIpSxLGkLtWKYk8UzSyAJCq
 MWZUv90YCAWpHeH+wUbT11Tn9UyqYGKNb+NCg05CtTZy0ipFCbhwFIsBhycO5lmWffUAsusTTuy
 kAYX2IiQ/koBMn89wr6GsMj+1n2xTIe/8snvI/UnAOrLq/gUxesHfRCR+w==
X-Google-Smtp-Source: AGHT+IFMNCUASRLGrHRwPdMteS6BfufWuL4pu1tw6U4dPKM+IWY1RxcN+hch2bEw1w9CsVdH+Wf5Pw==
X-Received: by 2002:a17:907:3faa:b0:ad5:2b4e:bb7b with SMTP id
 a640c23a62f3a-ad85b0be7a8mr547963366b.15.1748186086407; 
 Sun, 25 May 2025 08:14:46 -0700 (PDT)
Received: from localhost ([185.229.154.237])
 by smtp.gmail.com with UTF8SMTPSA id
 a640c23a62f3a-ad52d06b497sm1526104466b.42.2025.05.25.08.14.45
 for <bug-auctex@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 25 May 2025 08:14:45 -0700 (PDT)
From: "Paul D. Nelson" <ultrono@HIDDEN>
Date: Sun, 25 May 2025 17:14:44 +0200
Message-ID: <uxsg7tbjrgracb.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::533;
 envelope-from=ultrono@HIDDEN; helo=mail-ed1-x533.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,
 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.0 (+)
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: -0.0 (/)

--=-=-=
Content-Type: text/plain

Hi all,

I noticed that TeX-find-macro-end doesn't work as expected way on, e.g.,

  \begin{enumerate}[a)]

The issue arose organically when folding such macros.

To see the basic issue, evaluate the following in scratch:

--8<---------------cut here---------------start------------->8---
(mapcar
 (lambda (str)
   (with-temp-buffer
     (LaTeX-mode)
     (insert str)
     (char-to-string (char-before (TeX-find-macro-end-helper (point-min))))))
 '("\begin{enumerate}[a]"
   "\begin{enumerate}[(a)]"
   "\begin{enumerate}[a)]"))
--8<---------------cut here---------------end--------------->8---

This returns ("]" "]" ")") but should return ("]" "]" "]").

The attached patch seems to address the issue by using a stripped syntax
table, which seems like a standard approach in tex.el.  Any feedback
would be welcome.

Paul


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Fix-TeX-macro-end-detection-in-some-edge-cases.patch

From c523eeedf567499d98d46c3dd6f04629f96799aa Mon Sep 17 00:00:00 2001
From: Paul Nelson <ultrono@HIDDEN>
Date: Sun, 25 May 2025 17:11:49 +0200
Subject: [PATCH] Fix TeX macro end detection in some edge cases

* tex.el (TeX-find-macro-end-helper): Use
TeX-search-syntax-table with square brackets when calling
forward-sexp.  This fixes parsing of optional arguments
containing other unmatched delimiters, such as
\begin{enumerate}[a)], where the search would stop at ')'
instead of ']'.
---
 tex.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tex.el b/tex.el
index e90252d8..d65599be 100644
--- a/tex.el
+++ b/tex.el
@@ -5867,7 +5867,8 @@ those will be considered part of it."
                        (looking-at "[ \t]*\\(\\[\\)"))))
             (goto-char (match-beginning 1))
             (condition-case nil
-                (forward-sexp)
+                (with-syntax-table (TeX-search-syntax-table ?\[ ?\])
+                  (forward-sexp))
               (scan-error (throw 'found (point)))))
            ;; Skip over pairs of curly braces
            ((or (looking-at "[ \t]*\n?[ \t]*{") ; Be conservative: Consider
-- 
2.39.3 (Apple Git-145)


--=-=-=--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: "Paul D. Nelson" <ultrono@HIDDEN>
Subject: bug#78587: Acknowledgement ([PATCH] TeX-find-macro-end)
Message-ID: <handler.78587.B.174818610015559.ack <at> debbugs.gnu.org>
References: <uxsg7tbjrgracb.fsf@HIDDEN>
X-Gnu-PR-Message: ack 78587
X-Gnu-PR-Package: auctex
X-Gnu-PR-Keywords: patch
Reply-To: 78587 <at> debbugs.gnu.org
Date: Sun, 25 May 2025 15:15:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-auctex@HIDDEN

If you wish to submit further information on this problem, please
send it to 78587 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
78587: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78587
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-auctex@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#78587: [PATCH] TeX-find-macro-end
Resent-From: Arash Esbati <arash@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-auctex@HIDDEN
Resent-Date: Mon, 26 May 2025 13:21:02 +0000
Resent-Message-ID: <handler.78587.B78587.174826564525765 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 78587
X-GNU-PR-Package: auctex
X-GNU-PR-Keywords: patch
To: "Paul D. Nelson" <ultrono@HIDDEN>
Cc: 78587 <at> debbugs.gnu.org
Received: via spool by 78587-submit <at> debbugs.gnu.org id=B78587.174826564525765
          (code B ref 78587); Mon, 26 May 2025 13:21:02 +0000
Received: (at 78587) by debbugs.gnu.org; 26 May 2025 13:20:45 +0000
Received: from localhost ([127.0.0.1]:56117 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uJXkz-0006hV-18
	for submit <at> debbugs.gnu.org; Mon, 26 May 2025 09:20:45 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34996)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <arash@HIDDEN>) id 1uJXks-0006gs-TW
 for 78587 <at> debbugs.gnu.org; Mon, 26 May 2025 09:20:39 -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 1uJXkm-00005D-Fv; Mon, 26 May 2025 09:20:32 -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=6XlM8vHxvlDfp8dx/hvxl7NXe738D/eRdAs58X+SIH8=; b=gU1Xub3uQ7vcUu9SZF3R
 qet99mFlYvSBhR5hI+Z7aRcelczeAwEzdm+2/n/Vpjc4xOBI1TjyKZJn5dCtWZKCqeq7tEjCO0Fvy
 ov7GR6RIZH5u95GuYCAq+jIHn1r/Pu4V9tvXgh839KPOI7/NeKhX+DC0+i/SfyfoLorTr9IEqUuIw
 Ik15eER6+bW8Hq+jI40HXQwv98UljSbS6ib9wPnind8E0cDLfGWzZ1eeqS8c9o7CSIkpJ8zF1bQrX
 FMmjQbFxrptTmntLSCyqVocqwlvbQNqMv9RYmkwvz4D72Abss+BSginaTa8TDJJluTKcKrn48fjkw
 mvO3VK9iFNL/4A==;
From: Arash Esbati <arash@HIDDEN>
In-Reply-To: <uxsg7tbjrgracb.fsf@HIDDEN>
References: <uxsg7tbjrgracb.fsf@HIDDEN>
Date: Mon, 26 May 2025 15:20:28 +0200
Message-ID: <m27c23a4pv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
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 D. Nelson" <ultrono@HIDDEN> writes:

> I noticed that TeX-find-macro-end doesn't work as expected way on, e.g.,
>
>   \begin{enumerate}[a)]
>
> The issue arose organically when folding such macros.
>
> To see the basic issue, evaluate the following in scratch:
>
> (mapcar
>  (lambda (str)
>    (with-temp-buffer
>      (LaTeX-mode)
>      (insert str)
>      (char-to-string (char-before (TeX-find-macro-end-helper (point-min))))))
>  '("\begin{enumerate}[a]"
>    "\begin{enumerate}[(a)]"
>    "\begin{enumerate}[a)]"))
>
> This returns ("]" "]" ")") but should return ("]" "]" "]").
>
> The attached patch seems to address the issue by using a stripped syntax
> table, which seems like a standard approach in tex.el.  Any feedback
> would be welcome.

What do get with your patch when you eval this form:

--8<---------------cut here---------------start------------->8---
(mapcar
 (lambda (str)
   (with-temp-buffer
     (LaTeX-mode)
     (insert str)
     (char-to-string (char-before (TeX-find-macro-end-helper (point-min))))))
 '("\begin{enumerate}[a]"
   "\begin{enumerate}[(a)]"
   "\begin{enumerate}[a)]"
   "\begin{enumerate}[a{]}]"))
--8<---------------cut here---------------end--------------->8---

Best, Arash





Last modified: Mon, 26 May 2025 13:30:02 UTC

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