From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: prevent part of user var highlighted as keyword in new lang mode Date: Wed, 19 Nov 2008 05:53:13 -0800 (PST) Organization: http://groups.google.com Message-ID: <4958acd8-5e0c-4e3b-98ca-2d5cc9200fd9@p35g2000prm.googlegroups.com> References: <56762f2d-095d-4059-8c6a-d1619fa51d94@s9g2000prm.googlegroups.com> <1227101512.415102@sj-nntpcache-2.cisco.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1227116185 25984 80.91.229.12 (19 Nov 2008 17:36:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Nov 2008 17:36:25 +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 18:37: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 1L2qzV-0003Jl-Un for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Nov 2008 18:37:26 +0100 Original-Received: from localhost ([127.0.0.1]:38362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2qyM-0002dG-PJ for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Nov 2008 12:36:14 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!p35g2000prm.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 48 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1227102793 16748 127.0.0.1 (19 Nov 2008 13:53:13 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 19 Nov 2008 13:53:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p35g2000prm.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.26.2 (KHTML, like Gecko) Version/3.2 Safari/525.26.12, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:164597 comp.emacs:97367 X-Mailman-Approved-At: Wed, 19 Nov 2008 12:35:54 -0500 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:59932 Archived-At: On Nov 19, 5:31 am, Scott Frazer wrote: > Xah wrote: > > in writing a new language mode, how do i prevent part of variable that > > gets highlighted as keyword? e.g. the =E2=80=9Cfor=E2=80=9D in =E2=80= =9Cinform=E2=80=9D. > > > 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 i'm not sure what's wrong. Here's my code: (defvar xlsl-keywords-regexp (regexp-opt xlsl-keywords 'word)) (defvar xlsl-type-regexp (regexp-opt xlsl-types 'words)) (defvar xlsl-constant-regexp (regexp-opt xlsl-constants 'words)) (defvar xlsl-event-regexp (regexp-opt xlsl-events 'words)) (defvar xlsl-functions-regexp (regexp-opt xlsl-functions 'words)) (setq xlsl-font-lock-keywords `( (,xlsl-type-regexp . font-lock-type-face) (,xlsl-constant-regexp . font-lock-constant-face) (,xlsl-event-regexp . font-lock-builtin-face) (,xlsl-functions-regexp . font-lock-function-name-face) (,xlsl-keywords-regexp . font-lock-keyword-face) )) but still, when i type for example =E2=80=9Cinformation=E2=80=9D, the =E2= =80=9Cfor=E2=80=9D is highlighted. Any other idea? Xah =E2=88=91 http://xahlee.org/ =E2=98=84