Subject: Re: bug#35140: 12.1; Scan errors in doctex mode with ^^A-comments after braces

From: Arash Esbati <[email-masked]>
Date: Thu, 03 Mar 2022 09:22:51 +0100

Stefan Monnier <[email-masked]> writes:

> I'm not sufficiently informed about DocTeX to know what's the right
> thing to do here.  Changing the code so it only changes the face but
> without messing with syntax tables would definitely be simpler.

Thanks for your comment.  I'm not sure if you want to change this in
tex-mode.el as well, but the current code of
`doctex-syntax-propertize-rules' should be changed like this:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index ab94036d01..d43eb5f4cc 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -3019,7 +3019,7 @@ doctex-font-lock-syntactic-face-function
     (syntax-propertize-precompile-rules
      latex-syntax-propertize-rules
      ;; For DocTeX comment-in-doc.
-     ("\\(\\^\\)\\^A" (1 (doctex-font-lock-^^A))))))
+     ("\\(\\^\\)\\^[AX]" (1 (doctex-font-lock-^^A))))))

 (defvar doctex-font-lock-keywords
   (append tex-font-lock-keywords
--8<---------------cut here---------------end--------------->8---

^^X is also a comment starter beginning with doc.sty v3 (which will be
part of next LaTeX release).

Best, Arash