Subject: bug#52872: 13.0.15; wrong type argument error on calling ‘LaTeX-xparse-macro-parse’

From: Andrea Greselin <[email-masked]>
Date: Wed, 29 Dec 2021 16:20:33 +0100

Hello,
after updating to AUCTeX 13.0.15 I started getting a wrong type
argument error on opening certain .tex files. The traceback showed
that the culprit was ‘LaTeX-xparse-macro-parse’ calling
‘replace-regexp-in-string’ with a nil ‘spec’ argument. If I understand
correctly, the function is reading the ‘name’, ‘spec’ and ‘what’ local
variables from the ‘xcmd’ list with an offset wrt to v. 13.0.14. The
attached patch removes the offset and it’s fixed the issue for me.
diff --git a/auctex-13.0.15/style/xparse.el b/auctex-13.0.15/style/xparse.el
index fd9bb32..26934f1 100644
--- a/auctex-13.0.15/style/xparse.el
+++ b/auctex-13.0.15/style/xparse.el
@@ -108,9 +108,9 @@ TYPE is one of the symbols mac or env."
   (dolist (xcmd (if (eq type 'mac)
                     (LaTeX-xparse-macro-list)
                   (LaTeX-xparse-environment-list)))
-    (let ((name (nth 1 xcmd))
-          (spec (nth 2 xcmd))
-          (what (nth 3 xcmd))
+    (let ((name (nth 0 xcmd))
+          (spec (nth 1 xcmd))
+          (what (nth 2 xcmd))
           args opt-star opt-token)
       (with-temp-buffer
         (set-syntax-table LaTeX-mode-syntax-table)