From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: how to attach properties to a piece of text? Date: Wed, 18 Mar 2009 17:20:24 -0700 (PDT) Organization: http://groups.google.com Message-ID: <3f3f751a-a93a-4de6-a306-bf5f47bc9fea@v5g2000prm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1237441383 23469 80.91.229.12 (19 Mar 2009 05:43:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2009 05:43:03 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 19 06:44:20 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LkB3E-0000vU-3r for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2009 06:44:20 +0100 Original-Received: from localhost ([127.0.0.1]:48380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkB1r-0006AC-Fn for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2009 01:42:55 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v5g2000prm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 24.6.175.142 Original-X-Trace: posting.google.com 1237422024 27988 127.0.0.1 (19 Mar 2009 00:20:24 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 19 Mar 2009 00:20:24 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v5g2000prm.googlegroups.com; posting-host=24.6.175.142; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:167772 X-Mailman-Approved-At: Thu, 19 Mar 2009 01:32:15 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63072 Archived-At: 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 =3D <1,0,0>; vector green =3D <0,1,0>; vector blue =3D <0,0,1>; vector black =3D <0,0,0>; vector white =3D <1,1,1>; vector pink =3D <1,0.07843,0.5765>; vector orange =3D <1,0.6471,0>; vector brown =3D <0.5451,0.1373,0.1373>; vector purple =3D <0.3333,0.102,0.5451>; vector gold =3D <1,0.8431,0>; I want to be able write a function, something named color-vectors- region, so that any '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 =E2=88=91 http://xahlee.org/ =E2=98=84