From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Scott Frazer Newsgroups: gmane.emacs.help Subject: Re: prevent part of user var highlighted as keyword in new lang mode Date: Wed, 19 Nov 2008 08:31:52 -0500 Organization: Ye 'Ol Disorganized NNTPCache groupie Message-ID: <1227101512.415102@sj-nntpcache-2.cisco.com> References: <56762f2d-095d-4059-8c6a-d1619fa51d94@s9g2000prm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1227102386 4222 80.91.229.12 (19 Nov 2008 13:46:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Nov 2008 13:46:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 19 14:47:28 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L2nOl-0003c2-Rc for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Nov 2008 14:47:16 +0100 Original-Received: from localhost ([127.0.0.1]:40074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2nNd-00053B-8p for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Nov 2008 08:46:05 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe14.iad.POSTED!7564ea0f!not-for-mail User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) Original-Newsgroups: gnu.emacs.help,comp.emacs In-Reply-To: <56762f2d-095d-4059-8c6a-d1619fa51d94@s9g2000prm.googlegroups.com> Cache-Post-Path: sj-nntpcache-2.cisco.com!unknown@scfrazer-wxp.cisco.com X-Cache: nntpcache 3.0.2 (see http://www.nntpcache.com/) Original-Lines: 17 Original-X-Complaints-To: newsadmin@cisco.com Original-NNTP-Posting-Date: Wed, 19 Nov 2008 13:31:52 UTC Original-Xref: news.stanford.edu gnu.emacs.help:164596 comp.emacs:97366 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59930 Archived-At: Xah wrote: > in writing a new language mode, how do i prevent part of variable that > gets highlighted as keyword? e.g. the “for” in “inform”. > > i'm using > (setq font-lock-defaults '((xlsl-font-lock-keywords) nil nil)) > You need to wrap your regexp with markers that indicate the beginning/end of the empty string or symbol, e.g. these are the symbol ones: (concat "\\_<\\(" (regexp-opt '("form" "foo" "bar")) "\\)\\_>") See the "Backslash constructs in regular expressions" section in the Elisp manual. Scott