* Can a face have different attributes in different buffers?
@ 2005-01-22 23:22 Yevgeniy Makarov
2005-01-23 0:02 ` Pascal Bourguignon
0 siblings, 1 reply; 5+ messages in thread
From: Yevgeniy Makarov @ 2005-01-22 23:22 UTC (permalink / raw)
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?
Thank you,
Yevgeniy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can a face have different attributes in different buffers?
2005-01-22 23:22 Can a face have different attributes in different buffers? Yevgeniy Makarov
@ 2005-01-23 0:02 ` Pascal Bourguignon
2005-01-23 2:19 ` Johan Bockgård
0 siblings, 1 reply; 5+ messages in thread
From: Pascal Bourguignon @ 2005-01-23 0:02 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can a face have different attributes in different buffers?
2005-01-23 0:02 ` Pascal Bourguignon
@ 2005-01-23 2:19 ` Johan Bockgård
2005-01-23 5:09 ` Yevgeniy Makarov
0 siblings, 1 reply; 5+ messages in thread
From: Johan Bockgård @ 2005-01-23 2:19 UTC (permalink / raw)
Pascal Bourguignon <spam@mouse-potato.com> writes:
> I don't think that's possible. Faces are referenced thru symbols.
The standard font lock faces are referenced through variables.
C-h v font-lock-comment-face RET =>
font-lock-comment-face's value is
font-lock-comment-face
Face name to use for comments.
Defined in `font-lock'.
> 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.
It doesn't, though.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can a face have different attributes in different buffers?
2005-01-23 2:19 ` Johan Bockgård
@ 2005-01-23 5:09 ` Yevgeniy Makarov
2005-01-24 17:31 ` Kevin Rodgers
0 siblings, 1 reply; 5+ messages in thread
From: Yevgeniy Makarov @ 2005-01-23 5:09 UTC (permalink / raw)
Johan Bockgård wrote:
> The standard font lock faces are referenced through variables.
That's a great idea. I created a new face called mail-quotation-face after the
example of font-lock-comment-face, and then put the following code in .emacs:
(add-hook 'mail-mode-hook
'(lambda ()
(make-local-variable 'font-lock-comment-face)
(setq font-lock-comment-face 'mail-quotation-face)))
This makes quotation one color, and the comments in other buffers are another
color.
Thank you again,
Yevgeniy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can a face have different attributes in different buffers?
2005-01-23 5:09 ` Yevgeniy Makarov
@ 2005-01-24 17:31 ` Kevin Rodgers
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2005-01-24 17:31 UTC (permalink / raw)
Yevgeniy Makarov wrote:
> (add-hook 'mail-mode-hook
> '(lambda ()
> (make-local-variable 'font-lock-comment-face)
> (setq font-lock-comment-face 'mail-quotation-face)))
FYI, that can be shortened to
(add-hook 'mail-mode-hook
(lambda ()
(set (make-local-variable 'font-lock-comment-face)
'mail-quotation-face)))
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-01-24 17:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-22 23:22 Can a face have different attributes in different buffers? Yevgeniy Makarov
2005-01-23 0:02 ` Pascal Bourguignon
2005-01-23 2:19 ` Johan Bockgård
2005-01-23 5:09 ` Yevgeniy Makarov
2005-01-24 17:31 ` Kevin Rodgers
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.