help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Context sensitive code highlighting.


From: Eric M. Ludlam
Subject: Re: Context sensitive code highlighting.
Date: Wed, 09 Apr 2008 22:53:41 GMT
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>>> Robin.Fairey@gmail.com seems to think that:
>How hard would it be to implement context sensitive font lock
>behaviour? I'm thinking of something that scans the code for an
>argument list and then highlights subsequent occurences of the
>argument names in a new colour. This requires adding new keywords to
>the highlighter on the fly, determined by content in the file itself
>instead of in a keyword list at the beginning of the process. I've
>tweaked some other syntax highlighting modes, but I've no idea where
>to start with this one. I'm not looking for a full solution, just a
>pointer to where to start looking, or something I can read and modify
>to my needs?

If you have particularly complex context/highlighting needs, in
CEDET/Semantic there is a decoration mode which calls your function
whenever a semantic tag (function, variable, argument, struct field,
etc) is found, and you can then highlight it using any mechanism you
like, though creating the overlays w/ the decoration API makes sure they
are kept up to date.

One sample mode in CEDET puts an overline on top of any function or data
type that is a certain length.

http://cedet.sourceforge.net/

Of course, then your highlighter is dependent on a particularly complex
secondary installation.

Eric


reply via email to

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