TeXnicien de Surface | 23 Aug 2012 11:03
Picon

adapt auctex to the latex3 syntax

hello all

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 :
)

and that works *partially* i.e. I obtain the good face for "\c_" but it 
stops there and the color is not the same for the remaining part of the 
macro name.

What do I miss?

many thanks for any hint

GNU Emacs 23.3.1 on Ubuntu 12.04 / AucTeX 11.86

--

-- 
Le TeXnicien de Surface
TeXnicien de Surface | 23 Aug 2012 11:14
Picon

Re: adapt auctex to the latex3 syntax

Le 23/08/2012 11:03, TeXnicien de Surface a écrit / wrote :
> hello all
>
> 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 :
> )
>
> and that works *partially* i.e. I obtain the good face for "\c_" but it
> stops there and the color is not the same for the remaining part of the
> macro name.

! Wishfull seeing! It does *not* work at all. The color does not change.

I'm missing more than I thought.

Any help greatly appreciated.

--

-- 
Le TeXnicien de Surface
Nicolas Richard | 27 Aug 2012 15:18
Picon
Favicon

Re: adapt auctex to the latex3 syntax

TeXnicien de Surface <le.texnicien.de.surface <at> wanadoo.fr> 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 "\\\\[ <at> 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 "\\\\[ <at> A-Za-z:_]+" limit t))

to get the desired behaviour.

Or perhaps it would be good to have
(Continue reading)

TeXnicien de Surface | 27 Aug 2012 17:09
Picon

Re: adapt auctex to the latex3 syntax

Le 27/08/2012 15:18, Nicolas Richard a écrit :
> TeXnicien de Surface <le.texnicien.de.surface <at> wanadoo.fr> 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 "\\\\[ <at> 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 "\\\\[ <at> A-Za-z:_]+" limit t))
>
> to get the desired behaviour.
(Continue reading)

Nicolas Richard | 28 Aug 2012 13:40
Picon
Favicon

Re: adapt auctex to the latex3 syntax

TeXnicien de Surface <le.texnicien.de.surface <at> wanadoo.fr> writes:

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

Maybe having the characters _ and : as words would be too confusing when
editing the actual text (some people also use LaTeX for typesetting
their documents, not just for programming ;)).

Anyway, I guess the straightforward way would be to create a style file
expl3.el ?

--

-- 
Nico.

Gmane