[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fontifying of user defined variables
From: |
Dieter Wilhelm |
Subject: |
Re: fontifying of user defined variables |
Date: |
Sat, 16 Sep 2006 09:42:05 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"rgb" <rbielaws@i1.net> writes:
> Dieter Wilhelm wrote:
>> dieter@duenenhof-wilhelm.de writes:
>> >
>> > I'd like to highlight user specified variables in a major mode for a
>> > simple macro language (Ansys parametric design language or APDL).
>> > All number variables are specified with the following assignment:
>> >
>> > VARIABEL=VALUE
...
>> >
> The potential problem is that variables will be highlighted no matter
> where they appear. Even before the point they are defined.
Right, since Ansys allows variables names which are identical to some
command options, for example.
>
> The only way around that problem (that I know of) is to supply a
> function rather than a regexp to font-lock-keywords. The
...
> must know what to look for (because it's only argument is
> search-limit) whereas re-search-forward gets a regexp argument
> that tells it what to look for.
I see, thanks for the introduction to the enhanced font-lock
capability.
>
> Your periodic scanning function would still maintain a list of
> variable names to highlight but wouldn't update font-lock-keywords.
> Instead, it saves them to some other variable of your choosing in
> a list that includes a marker to where the definition was detected.
>
I could use some timer, I've never tried but I guess there is a timer
functionality in Emacs which allows such a scanning operation only
when Emacs is idling.
> The function you provide to font-lock-keywords would then
> find keywords (variable names) only if they occured after the
...
> it over and over.
>
> Good luck
Thanks for your friendly advice.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany