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

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

Re: Syntax Highlighting variables


From: Marco Baringer
Subject: Re: Syntax Highlighting variables
Date: Sun, 10 Jun 2001 21:43:08 +0200
User-agent: Mutt/1.2.5i

On Thu, Jun 07, 2001 at 03:54:33PM -0400, Dan Cardamore wrote:
> How can I get emacs to fontify my variables in color after they're
> defined.
> 
> For example in C++:
> 
> int a;   // a is green which is what I want
> a = 1;   // a is plain white now just like normal text (I want green
>          //     again)
> 
> 
> Or in Perl:
> 
> my $var;   # $var is green
> $var = 1;  # $var is white again.
> 
> 
> I already have font-lock-maximum-decoration set to true.
> 
> Thanks for any help,
> 

I don't think emacs does this of it's own accord, fontifying is done
using regexps, a regexp is assigned to font-face. What you'd have to
do is create a hash table and keep variable names in that. as is often
my case, i know what needs to be done, but have no idea as to how to
do it? would this function be assigned to the ' ' or ';' or ','
characters? then what happens when you remove the definition of a
variable name, you'd have to make sure to remove that entry in the
hash table.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There's a crack in everything.
It's how the light gets in.
        -Isonard Cohen

Attachment: pgpRcY4IjlkBO.pgp
Description: PGP signature


reply via email to

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