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: Drew Adams
Subject: RE: prevent part of user var highlighted as keyword in new lang mode
Date: Wed, 19 Nov 2008 09:56:05 -0800

> (defvar xlsl-keywords-regexp (regexp-opt xlsl-keywords 'word))
> (setq xlsl-font-lock-keywords
>   `(... (,xlsl-keywords-regexp . font-lock-keyword-face)))
> 
> when i type ... "information", the "for" is highlighted.

Sounds like there might be interference among the patterns. Try just one of the
regexps at a time, commenting out the others. But you didn't show any of the
regexps you use, so it's hard to guess. ;-)

It might also be that you need to specify the group of the regexp that you want
to highlight. Here's an example that highlights a group (first regexp line) and
entire matches (other two regexp lines). The `1' says to use whatever the first
group matches.

(defvar shell-font-lock-keywords
  '(("[ \t]\\([+-][^ \t\n]+\\)" 1 font-lock-comment-face)
    ("^[^ \t\n]+:.*" . font-lock-string-face)
    ("^\\[[1-9][0-9]*\\]" . font-lock-string-face))
  "Additional expressions to highlight in Shell mode.")





reply via email to

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