From 7d9f9d4d8e8b8836e317dc85dd757bb78200c20e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 15 Mar 2022 10:12:46 -0400 Subject: [PATCH] doctex-mode: Try and fix bug#35140 * lisp/textmodes/tex-mode.el (doctex-syntax-propertize-rules): Add support for the new ^^X and consider the first ^ of ^^A to be the closing char for the previous comment. (doctex-font-lock-^^A): Simplify accordingly. --- lisp/textmodes/tex-mode.el | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index ab94036d01d..aa6fd245188 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -2989,13 +2989,7 @@ There might be text before point." (put-text-property (1- (match-beginning 1)) (match-beginning 1) 'syntax-table - (if (= (1+ (line-beginning-position)) (match-beginning 1)) - ;; The `%' is a single-char comment, which Emacs - ;; syntax-table can't deal with. We could turn it - ;; into a non-comment, or use `\n%' or `%^' as the comment. - ;; Instead, we include it in the ^^A comment. - (string-to-syntax "< b") - (string-to-syntax ">"))) + (string-to-syntax ">")) (let ((end (line-end-position))) (if (< end (point-max)) (put-text-property @@ -3018,8 +3012,9 @@ There might be text before point." (defconst doctex-syntax-propertize-rules (syntax-propertize-precompile-rules latex-syntax-propertize-rules - ;; For DocTeX comment-in-doc. - ("\\(\\^\\)\\^A" (1 (doctex-font-lock-^^A)))))) + ;; For DocTeX comment-in-doc (DocTeX ≥3 also allows ^^X). + ;; We make the comment start on the second char because of bug#35140. + ("\\^\\(\\^\\)[AX]" (1 (doctex-font-lock-^^A)))))) (defvar doctex-font-lock-keywords (append tex-font-lock-keywords -- 2.39.5