[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q on multiple faces as text property `face'
From: |
Johan Bockgård |
Subject: |
Re: Q on multiple faces as text property `face' |
Date: |
Sat, 18 Feb 2006 20:00:10 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
"Drew Adams" <drew.adams@oracle.com> writes:
> I have two faces:
> (defface face1 '((t (:background "White"))) "Face 1")
> (defface face2 '((t (:foreground "Blue"))) "Face 2")
>
> Using `put-text-property' with the `face' property:
> I put face2 on some text.
> I put face1 on some text.
>
> I would like the result to show, wherever both faces are applied to
> the same text, both a Blue foreground and White background. However,
> what happens is that the last face applied takes precedence - the
> other face contributes nothing.
It doesn't "take precedence".
put-text-property is a built-in function in `C source code'.
(put-text-property START END PROPERTY VALUE &optional OBJECT)
Set one property of the text from START to END.
^^^
The value of the `face' property is replaced altogether.
> I also tried with definitions like this, also to no avail:
> (defface face1 '((t (:background "White" :foreground unspecified))) "1")
> (defface face2 '((t (:foreground "Blue" :backround unspecified))) "2")
Obviously changing the face definitions will make no difference.
> What's the correct way to do what I want: accumulate (merge) properties from
> different faces? (No, I don't want to use overlays here.)
The value of the face property may be a list. Use/see
`font-lock-prepend-text-property' or `font-lock-append-text-property'.
--
Johan Bockgård