Thursday, September 26, 2013

Re: Improve context syntax file

On 2013–09–26 Paul Isambert wrote:

> > But I can't add it permanently. The underscore is only part of a
> > word in between the following blocks.
> >
> > \unprotect … \protect %% or
> > \starttexcode … \stoptexcode
>
> Since there is little chance that an underscore will immediately follow a
> control sequence anyway, I don't think defining it for the entire syntax file
> will cause any problem.

I tried this. But iskeyword does not change the syntax highlighting.
It only seems to have an effect on the "*" and similar commands. So
changing iskeyword is probably not what I'm after.

> However, you can do something along the following lines:
>
> sy match ControlSequence '\\[a-zA-Z]\+'
> sy match SpecialControlSequence '\\[a-zA-Z_]\+' contained
> sy region SpecialCode matchgroup=ControlSequence start='\\unprotect' end='\\protect' contains=SpecialControlSequence

I tried this, but it removes all syntax highlighting. Frankly, I
have no idea of how the syntax highlighting works. I have to read up
the basics to understand how this exactly works. The issue seems
more complicated than anticipated. But thanks for the snippet, it's
something to start with.

Marco

No comments: