From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Background colors in font-lock-keywords Date: Tue, 27 May 2003 10:30:39 -0600 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3ED392AF.2030607@yahoo.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1054053490 21156 80.91.224.249 (27 May 2003 16:38:10 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 27 May 2003 16:38:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue May 27 18:38:00 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 19KhSZ-0005Ts-00 for ; Tue, 27 May 2003 18:37:59 +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 19KhQF-0006LE-8G for gnu-help-gnu-emacs@m.gmane.org; Tue, 27 May 2003 12:35:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!newsfeed.mathworks.com.MISMATCH!newsfeed!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 58 Original-NNTP-Posting-Host: 170.207.51.80 Original-X-Trace: fu-berlin.de 1054053037 4625569 170.207.51.80 (16 [82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:113745 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:10240 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10240 Jesse Sheidlower wrote: > 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. I'd like to hear how your project turns out. Several years ago I implemented something similar, but instead of using font-lock (which wasn't mature at the time) I hacked my own (ELEMENT . OVERLAY-PROPERTY-LIST) association list. It had some nice features, like using overlay priorities to handled element nesting and a special function property so you could compute overlay properties dynamically, but I didn't maintain it to keep up with Emacs and PSGML. Now I think the right approach would be to implement XSL support in Emacs. > 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)) Sorry I can't help you with your face questions. But note that SGML's reference concrete syntax (the default, used by PSGML) also allows digits, hyphen, and period in entity names (just not as the first character); and XML additionally allows underscore and colon (even as the first character) in entity names. XML also allows non-ASCII letters and other Unicode characters. See http://xml.coverpages.org/sgmlsyn/sgmlsyn.htm#P55 http://www.w3.org/TR/REC-xml#NT-Name > 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) How do you handle elements that span more than 1 line? Does font-lock handle nested elements correctly for you? > , 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. ... -- <a href="mailto:<kevin.rodgers@ihs.com>">Kevin Rodgers</a>