From: jester@panix.com (Jesse Sheidlower)
Subject: Background colors in font-lock-keywords
Date: 27 May 2003 07:53:04 -0400 [thread overview]
Message-ID: <bavjj0$ot1$1@panix2.panix.com> (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
next reply other threads:[~2003-05-27 11:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-27 11:53 Jesse Sheidlower [this message]
2003-05-27 14:35 ` Background colors in font-lock-keywords 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
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='bavjj0$ot1$1@panix2.panix.com' \
--to=jester@panix.com \
/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.