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

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

Re: random color of variables in programming languages


From: Emanuel Berg
Subject: Re: random color of variables in programming languages
Date: Tue, 24 Dec 2013 20:31:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Luca Ferrari <fluca1978@infinito.it> writes:

> Very good example, thanks.

Yes, the example is good (or at least interesting) but
I think to actually make it work would require some
work.

First problem is, when to update the table?

Could it be done periodically without slowing
everything down? Remember the idle-timer, that perhaps
is suitable for a thing like that.

Or, what about the method with abbrev, when instead of
inserting a word, you evaluate code, as in:

("word" "" (lambda ()
              (interactive)
              ;; do stuff ))

Say that you define a variable with `int' (as in C),
then you could add "int" as such an "abbrev", and that
word would set a flag that indicates that work must be
done. If the idle-timer executes, but that flag isn't
set, no work is done (and the flag is unset at the end
of a "work burst").

Second problem is, how to remove stuff from the table?
When an int var_digit; line is removed, should
highlighting be dropped from the "var_digit"? Really, I
don't know, perhaps it is only good that it still
sticks out because each occurrence is a likely bug at
that state.

Perhaps it is easiest to have a separate keyword table,
and for each update, erase the whole thing and build it
anew.

Anyway, if you do anything more on this, be sure to
tell us.

-- 
Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu
underground experts united:  http://user.it.uu.se/~embe8573


reply via email to

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