From: Xah <xahlee@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 05:53:13 -0800 (PST) [thread overview]
Message-ID: <4958acd8-5e0c-4e3b-98ca-2d5cc9200fd9@p35g2000prm.googlegroups.com> (raw)
In-Reply-To: 1227101512.415102@sj-nntpcache-2.cisco.com
On Nov 19, 5:31 am, Scott Frazer <frazer.sc...@gmail.com> wrote:
> 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
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 “information”, the “for” is
highlighted.
Any other idea?
Xah
∑ http://xahlee.org/
☄
next prev parent reply other threads:[~2008-11-19 13:53 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
2008-11-19 13:53 ` Xah [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4958acd8-5e0c-4e3b-98ca-2d5cc9200fd9@p35g2000prm.googlegroups.com \
--to=xahlee@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).