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: TeXnicien de Surface
Subject: Re: [AUCTeX] adapt auctex to the latex3 syntax
Date: Mon, 27 Aug 2012 17:09:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0

Le 27/08/2012 15:18, Nicolas Richard a écrit :
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.

I've done this and it works. That's great!

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...

Same thing here.

Perhaps it would be a good idea to suggest the modification to the main code and provide a LaTeX3 syntax-table over the bargain.

Many thanks for you help.
--
Le TeXnicien de Surface




reply via email to

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