[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to attach properties to a piece of text?
From: |
Miles Bader |
Subject: |
Re: how to attach properties to a piece of text? |
Date: |
Thu, 19 Mar 2009 09:54:36 +0900 |
Xah Lee <xahlee@gmail.com> writes:
> 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?
`put-text-property'
In particular, you may want the :foreground attribute of the `face'
property.
E.g. try evaluating the following:
(put-text-property (point) (mark) 'face '(:foreground "green"))
However, note that if the buffer's mode uses font-lock, font-lock will
_override_ any `face' property you set (to be its own); in a font-lock'd
buffer, you can use the `font-lock-face' property instead:
(put-text-property (point) (mark) 'font-lock-face '(:foreground "green"))
-Miles
--
Cynic, n. A blackguard whose faulty vision sees things as they are, not as
they ought to be. Hence the custom among the Scythians of plucking out a
cynic's eyes to improve his vision.