unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to attach properties to a piece of text?
@ 2009-03-19  0:20 Xah Lee
  2009-03-19  0:54 ` Miles Bader
  0 siblings, 1 reply; 5+ messages in thread
From: Xah Lee @ 2009-03-19  0:20 UTC (permalink / raw)
  To: help-gnu-emacs

how to write a function that colors particular words matching regex
inside a region?

I was thinking using font-lock-add-keywords, but that does to the
whole buffer.

i haven't studied emacs's face, display property etc systems. But
could anyone give me a rough guide on what function i should use or
lookup?

Here's a bit detail on what i need to do. I'm writing a mode for
Linden scripting language (LSL). Colors are specified using lsl's
vector type, like this:

vector red = <1,0,0>;
vector green = <0,1,0>;
vector blue = <0,0,1>;
vector black = <0,0,0>;
vector white = <1,1,1>;
vector pink = <1,0.07843,0.5765>;
vector orange = <1,0.6471,0>;
vector brown = <0.5451,0.1373,0.1373>;
vector purple = <0.3333,0.102,0.5451>;
vector gold = <1,0.8431,0>;

I want to be able write a function, something named color-vectors-
region, so that any <r,g,b>'s background is colored using the rgb
value. (each is a float from 0 to 1.) The part i don't know how, is
how to attach a text color property to a piece of text.

Thanks.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-19 15:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19  0:20 how to attach properties to a piece of text? Xah Lee
2009-03-19  0:54 ` Miles Bader
2009-03-19  3:19   ` Xah Lee
2009-03-19 15:51     ` Drew Adams
2009-03-19 13:11   ` Xah Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).