From: Scott Frazer <frazer.scott@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: prevent part of user var highlighted as keyword in new lang mode
Date: Wed, 19 Nov 2008 08:31:52 -0500 [thread overview]
Message-ID: <1227101512.415102@sj-nntpcache-2.cisco.com> (raw)
In-Reply-To: <56762f2d-095d-4059-8c6a-d1619fa51d94@s9g2000prm.googlegroups.com>
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
next prev parent reply other threads:[~2008-11-19 13:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 2:37 prevent part of user var highlighted as keyword in new lang mode Xah
2008-11-19 13:31 ` Scott Frazer [this message]
2008-11-19 13:53 ` Xah
2008-11-19 17:56 ` Drew Adams
2008-11-19 18:11 ` Scott Frazer
2008-11-20 2:41 ` Xah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1227101512.415102@sj-nntpcache-2.cisco.com \
--to=frazer.scott@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.