GNU bug report logs - #62997
13.1.10; LaTeX-xparse-macro-parse in xparse.el fails when opening a LaTeX file

Previous Next

Package: auctex;

Reported by: Yuki Nishida <nishida <at> rsworks.jp>

Date: Fri, 21 Apr 2023 15:05:02 UTC

Severity: normal

Found in version 13.1.10

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 62997 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Yuki Nishida <nishida <at> rsworks.jp>
Cc: 62997 <at> debbugs.gnu.org
Subject: Re: bug#62997: 13.1.10; LaTeX-xparse-macro-parse in xparse.el fails
 when opening a LaTeX file
Date: Fri, 21 Apr 2023 20:28:43 +0200
Yuki Nishida <nishida <at> rsworks.jp> writes:

> In a particular environment, opening a LaTeX file for the first time
> fails with the *Backtrace* buffer that says LaTeX-xparse-macro-parse
> fails with (scan-error “Unbalanced parentheses” ...)
>
> It seems to be caused by an xparse macro definition containing '(' as
> a token in an argument's specification like:
>
> \NewDocumentCommand\FOO{>{\SplitArgument{1}{(}}m}
>
> I suspect the implementation interprets '(}' as balanced parentheses
> and causes the scan-error.

Thanks for the report.  Can you please apply this patch to xparse.el and
report back if it solves the issue?

--8<---------------cut here---------------start------------->8---
diff --git a/style/xparse.el b/style/xparse.el
index 397a0c4b..ca70fd68 100644
--- a/style/xparse.el
+++ b/style/xparse.el
@@ -128,7 +128,8 @@ TYPE is one of the symbols mac or env."
                 ;; over [>=] and a balanced {}
                 ((looking-at-p "[>=]")
                  (forward-char 1)
-                 (forward-sexp))
+                 (with-syntax-table (TeX-search-syntax-table ?\{ ?\})
+                   (forward-sexp)))
                 ;; Mandatory arguments:
                 ;; m: Ask for input with "Text" as prompt
                 ((looking-at-p "m")
--8<---------------cut here---------------end--------------->8---

TIA.  Best, Arash




This bug report was last modified 2 years and 30 days ago.

Previous Next


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