[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obsoleting font-latex-update-font-lock for fixing bug#37945

From: Ikumi Keita
Subject: Re: Obsoleting font-latex-update-font-lock for fixing bug#37945
Date: Thu, 11 Jun 2020 11:35:50 +0900

Hi Tassilo,

>>>>> Tassilo Horn <> writes:
> I noticed that adding new keywords using `font-latex-add-keywords'
> doesn't seem to require such a hard reset because they change just a
> variable used by some font-latex-match-* function (which is in
> font-lock-keywords already), so at most we must flush the current
> fontification but nothing more.

I came to similar consideration as well, so I think the change is good.

> Since I'm doing really nothing with LaTeX nowadays, it would be fabulous
> if some of you folks could try out that branch and tell me what breaks.

Actually, there is another "hard reset" in font-latex.el. The function
`font-latex-add-to-syntax-alist' also sets `font-lock-set-defaults' to
nil in order to apply the update in `font-latex-syntax-alist' to
I think something like the following patch would do the job:
diff --git a/font-latex.el b/font-latex.el
index a7076162..d74ccace 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1223,8 +1223,10 @@ triggers Font Lock to recognize the change."
   (set (make-local-variable 'font-latex-syntax-alist)
        (append font-latex-syntax-alist list))
   ;; Tell font-lock about the update.
-  (setq font-lock-set-defaults nil)
-  (font-latex-setup))
+  ;; (setq font-lock-set-defaults nil)
+  (font-latex-setup)
+  (dolist (elt list)
+    (modify-syntax-entry (car elt) (cdr elt) font-lock-syntax-table)))
 (defun font-latex-syntax-propertize-function (start end)
   "The `syntax-propertize-function' for (La)TeX documents."
The call to `font-latex-setup' is there only to keep the variable
`font-lock-defaults' in sync with `font-latex-syntax-alist', just for
not confusing debug.
Maybe `font-lock-flush' should be added as well.

Ikumi Keita

reply via email to

[Prev in Thread] Current Thread [Next in Thread]