all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Background colors in font-lock-keywords
@ 2003-05-27 11:53 Jesse Sheidlower
  2003-05-27 14:35 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jesse Sheidlower @ 2003-05-27 11:53 UTC (permalink / raw)



I'm developing a derived mode of psgml in order to set up my own
highlighting of particular tags and tag groups using font-lock,
and I'm having trouble with two things relating to the background
of faces I'm using.

First, I'd like certain faces to use as a background any other
element they happen to be on. For example, in my font-lock-keywords
section I define entity references for this application as:

  ("&[a-zA-z]+;" . (0 my-entity-face t))

I've defined my-entity-face with a red foreground color and a
weight of bold. What I would like is for the background to
match whatever it's on, so that if there's an entity reference
in text that happens to be white, it will be red with a white
background, but if, in another font-lock-keywords expression,
I have defined

  ("<title>\\(.*?\\)</title>" 1 my-title-face t)

, with my-title-face having a light-green background, then I
would like an entity reference used in a <title> to be red but
also with a light-green background. Is there any way of
accomplishing this? I've been experimenting to no avail.

Second, is there a way to associate a background color with a particular
buffer only? For this same mode, I would like to get a lighly shaded
background with white as the main background color for actual sgml (i.e.
at the end of a line, text will appear light gray after the last closing
tag). I have accomplished this by, in my mode definition,

  (set-background-color "gray90")

and then in my font-lock-keywords,

  ("^\\(<.*>\\)$" 1 my-background-face keep)

, with my-background-face defined as just having a white background,
and then (to solve the same problem as above) having other faces
inherit from this background. Is there a better way to do this? One
particular problem is that when I kill a buffer in this mode, I'm left
with a light-gray buffer wherever else I am, which is annoying, so
at the least I'd like a way to get the grayness to be associated only
with something in this mode.

Thanks.

Jesse Sheidlower

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-05-28 16:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-27 11:53 Background colors in font-lock-keywords Jesse Sheidlower
2003-05-27 14:35 ` Stefan Monnier
2003-05-28 16:09   ` Jesse Sheidlower
2003-05-27 16:30 ` Kevin Rodgers
2003-05-27 17:12   ` Jesse Sheidlower
2003-05-27 22:23 ` Oliver Scholz
2003-05-27 22:43   ` Oliver Scholz
2003-05-28  0:13   ` lawrence mitchell
2003-05-28  7:32     ` Oliver Scholz
2003-05-28 13:15       ` lawrence mitchell
2003-05-28 16:13         ` Oliver Scholz

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.