auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] adapt auctex to the latex3 syntax


From: Nicolas Richard
Subject: Re: [AUCTeX] adapt auctex to the latex3 syntax
Date: Mon, 27 Aug 2012 15:18:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

TeXnicien de Surface <address@hidden> 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 "address@hidden" 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 "address@hidden:_]+" 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 "address@hidden: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.




reply via email to

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