Subject: 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:45:32 +0100

Hi Tassilo,

Tassilo Horn <[email-masked]> writes:

> Thanks for the heads-up, I've done that just now.
>
>   https://git.savannah.gnu.org/cgit/auctex.git/commit/?id=ab3bfaf1033f0d6e0ecfe3172794a6363450b207

Thanks for the quick fix.  Have you also tried to run 'make' in the
tests directory?  I get errors for three files, e.g. font-latex-test.el:

  Test font-latex-three-dollars condition:
      (error "Font-lock trying to use keywords before setting them up")

  Test font-latex-unclosed-dollars condition:
      (error "Font-lock trying to use keywords before setting them up")

It seems that calling `font-lock-ensure' after `LaTeX-mode' helps:

--8<---------------cut here---------------start------------->8---
diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 9cc7ac52..837f0b47 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -39,6 +39,7 @@
               (insert "% $$$ $$$
 $a$")
               (LaTeX-mode)
+              (font-lock-ensure)
               (goto-char (point-min))
               (setq font-latex--updated-region-end (point-max))
               (font-latex-match-dollar-math (point-max))))))
@@ -48,6 +49,7 @@ $a$")
   (let ((TeX-install-font-lock #'font-latex-setup))
     (with-temp-buffer
       (LaTeX-mode)
+      (font-lock-ensure)

       (insert "a$")
       (goto-char (point-min))
--8<---------------cut here---------------end--------------->8---

Is this the course of action or something smarter?

Best, Arash