From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jester@panix.com (Jesse Sheidlower) Newsgroups: gmane.emacs.help Subject: Background colors in font-lock-keywords Date: 27 May 2003 07:53:04 -0400 Organization: Oxford University Press Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1054036479 23543 80.91.224.249 (27 May 2003 11:54:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 27 May 2003 11:54:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue May 27 13:54:37 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Kd2L-00067Z-00 for ; Tue, 27 May 2003 13:54:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Kd3B-0007wo-Kr for gnu-help-gnu-emacs@m.gmane.org; Tue, 27 May 2003 07:55:29 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!newsfeed!panix!panix2.panix.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 49 Original-NNTP-Posting-Host: panix2.panix.com Original-X-Trace: reader1.panix.com 1054036384 18636 166.84.1.2 (27 May 2003 11:53:04 GMT) Original-X-Complaints-To: abuse@panix.com Original-NNTP-Posting-Date: Tue, 27 May 2003 11:53:04 +0000 (UTC) Original-Xref: shelby.stanford.edu gnu.emacs.help:113730 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10225 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10225 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 ("\\(.*?\\)" 1 my-title-face t) , with my-title-face having a light-green background, then I would like an entity reference used in a 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