From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: generic-mode: Keywords also highlight with an underscore Date: 24 Aug 2005 15:52:32 -0700 Organization: http://groups.google.com Message-ID: <1124923952.784406.294620@z14g2000cwz.googlegroups.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1124924238 2473 80.91.229.2 (24 Aug 2005 22:57:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Aug 2005 22:57:18 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 25 00:57:17 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E84Aj-0002d3-C1 for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Aug 2005 00:56:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E84EZ-0002As-5a for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Aug 2005 19:00:39 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: 198.74.20.77 Original-X-Trace: posting.google.com 1124923961 10874 127.0.0.1 (24 Aug 2005 22:52:41 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 24 Aug 2005 22:52:41 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=198.74.20.77; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:133438 Original-To: help-gnu-emacs@gnu.org 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:28969 Archived-At: > Say I did: > > (define-generic-mode 'fnord-mode > nil > (list "fnord" "foobar") > nil > (list "\\.fnord") > (list 'turn-on-font-lock)) > > This mode will then highlight the keywords fnord and foobar. > > However, it will also highlight _fnord, foobar_ and so on. > > I do not want the keyword to highlight if it has an > underscore attached to it. > > How can I get rid of this behaviour? > By far the easiest way is to give the underscore character word syntax. Which is exactly how I avoid the problem in tacl-mode. (modify-syntax-entry ?\_ "w" st) Other than that you probably need to use font-lock-list rather than keyword-list so you can build your own regexp that excludes the characters that shouldn't be allowed to touch the keywords.