help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a face have different attributes in different buffers?


From: Pascal Bourguignon
Subject: Re: Can a face have different attributes in different buffers?
Date: 23 Jan 2005 01:02:13 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Yevgeniy Makarov <emakarov@cs.indiana.edu> writes:

> Hello,
> 
> I have the following question. Judging by the fact that the function which
> sets an attribute of some face (set-face-attribute) takes a frame as an
> argument, it is not possible to have different buffers in one frame with
> different values of the same attribute. Is it so? For example, can I have
> comments of different colors (attribute :foreground of face
> font-lock-comment-face) in different buffers of the same frame?

I don't think that's possible.  Faces are referenced thru
symbols. Ie. the way it is implemented, faces are not first class
objects, they're attributes of symbols.  Symbols aren't specific to a
buffer.

The best you could do is to create new faces for each buffer, copying
the faces you want onto new gensym'ed symbols and refering them thru
buffer-local  variables.  Of course, since normal font-locking code
refers the faces "literally" thru the symbols they use, you'd have to
patch them or program your own font-locking.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The mighty hunter
Returns with gifts of plump birds,
Your foot just squashed one.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]