help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: prevent part of user var highlighted as keyword in new lang mode


From: Scott Frazer
Subject: Re: prevent part of user var highlighted as keyword in new lang mode
Date: Wed, 19 Nov 2008 08:31:52 -0500
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]