TeXnicien de Surface <[email protected]> writes:

> I would like to see a latex3 macro name such as \c_something:Nn
> "correctly" recognised as a macro name (to obtain the same face as
> with \something)
> I've tried to modify the syntax table with
>
> (defun latex-syntaxe-latex3()
>   "modifie la table de syntaxe pour faire de _ et : des lettres"
>   (interactive)
>   (modify-syntax-entry ?_ "w" LaTeX-mode-syntax-table)
>   ;; to be completed for :
> )

In fact the fontification for commands does not use the syntax table,
but is hardcoded in font-latex.el :

(defun font-latex-match-simple-command (limit)
  "Search for command like \\foo before LIMIT."
  (TeX-re-search-forward-unescaped "\\\\[@A-Za-z]+" limit t))

you can modify this function to :

(defun font-latex-match-simple-command (limit)
  "Search for command like \\foo before LIMIT."
  (TeX-re-search-forward-unescaped "\\\\[@A-Za-z:_]+" limit t))

to get the desired behaviour.

Or perhaps it would be good to have
(defun font-latex-match-simple-command (limit)
  "Search for command like \\foo before LIMIT."
  (TeX-re-search-forward-unescaped "\\\\[@[:word:]]+" limit t))
and change the syntax table as you did.

Regarding the syntax table, note that modifying it shows immediate
effect for some commands (e.g. describe-char or isearch-forward-regexp,
which really consider _ and : as words), but not for
font-lock-fontify-buffer : I had to M-x LaTeX-mode before font locking
was correctly updated u sing [:word:] in the regexp. I have no idea why.
Maybe the answer is in the code...

-- 
Nico.


_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to