all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: how to attach properties to a piece of text?
Date: Thu, 19 Mar 2009 09:54:36 +0900	[thread overview]
Message-ID: <877i2mgwmr.fsf@catnip.gol.com> (raw)
In-Reply-To: 3f3f751a-a93a-4de6-a306-bf5f47bc9fea@v5g2000prm.googlegroups.com

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.


  reply	other threads:[~2009-03-19  0:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19  0:20 how to attach properties to a piece of text? Xah Lee
2009-03-19  0:54 ` Miles Bader [this message]
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=877i2mgwmr.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --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.