From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: how to attach properties to a piece of text?
Date: Wed, 18 Mar 2009 17:20:24 -0700 (PDT) [thread overview]
Message-ID: <3f3f751a-a93a-4de6-a306-bf5f47bc9fea@v5g2000prm.googlegroups.com> (raw)
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/
☄
next reply other threads:[~2009-03-19 0:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-19 0:20 Xah Lee [this message]
2009-03-19 0:54 ` how to attach properties to a piece of text? Miles Bader
2009-03-19 3:19 ` Xah Lee
2009-03-19 15:51 ` Drew Adams
2009-03-19 13:11 ` Xah Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f3f751a-a93a-4de6-a306-bf5f47bc9fea@v5g2000prm.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.