branch: main
commit db11f39d36e9b78e3a5405076249f3b7c3f8d1f6
Author: Arash Esbati <ar...@gnu.org>
Commit: Arash Esbati <ar...@gnu.org>

    Improve fontification of expl3 macros
    
    * style/expl3.el (LaTeX-expl3-syntax-table): Give '_' and ':' word
    syntax which fixes fontification of things like \cs vs.
    \cs_no_fontification_rule:n.
    ("expl3"): Update font-lock internals more thoroughly by resetting
    `font-lock-major-mode'.  (bug#76781)
---
 style/expl3.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/style/expl3.el b/style/expl3.el
index 9ce0e4b0..60103dc4 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -38,9 +38,9 @@
 
 (defvar LaTeX-expl3-syntax-table
   (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
-    ;; Make _ and : symbol chars
-    (modify-syntax-entry ?\_ "_" st)
-    (modify-syntax-entry ?\: "_" st)
+    ;; Make _ and : word chars
+    (modify-syntax-entry ?\_ "w" st)
+    (modify-syntax-entry ?\: "w" st)
     st))
 
 (defun LaTeX-expl3--set-TeX-exit-mark (_optional &optional pos)
@@ -710,7 +710,10 @@ Pass OPTIONAL, PROMPT and NO-PARAM to 
`TeX-arg-expl3-macro', which see."
 
                                 ("cs_undefine:N" "\\")
                                 ("cs_undefine:c" "\\"))
-                              'function)))
+                              'function)
+     ;; Also tell font-lock to update its internals
+     (setq font-lock-major-mode nil)
+     (font-lock-set-defaults)))
  TeX-dialect)
 
 (defvar LaTeX-expl3-package-options-list

Reply via email to