[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: generic-mode: Keywords also highlight with an underscore
From: |
rgb |
Subject: |
Re: generic-mode: Keywords also highlight with an underscore |
Date: |
24 Aug 2005 15:52:32 -0700 |
User-agent: |
G2/0.2 |
> Say I did:
>
> (define-generic-mode 'fnord-mode
> nil
> (list "fnord" "foobar")
> nil
> (list "\\.fnord")
> (list 'turn-on-font-lock))
>
> This mode will then highlight the keywords fnord and foobar.
>
> However, it will also highlight _fnord, foobar_ and so on.
>
> I do not want the keyword to highlight if it has an
> underscore attached to it.
>
> How can I get rid of this behaviour?
>
By far the easiest way is to give the underscore character
word syntax. Which is exactly how I avoid the problem in
tacl-mode.
(modify-syntax-entry ?\_ "w" st)
Other than that you probably need to use font-lock-list
rather than keyword-list so you can build your own
regexp that excludes the characters that shouldn't
be allowed to touch the keywords.