[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
how to attach properties to a piece of text?
From: |
Xah Lee |
Subject: |
how to attach properties to a piece of text? |
Date: |
Wed, 18 Mar 2009 17:20:24 -0700 (PDT) |
User-agent: |
G2/1.0 |
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/
☄
- how to attach properties to a piece of text?,
Xah Lee <=