I am writing a minor mode for HTML/PHP templates.
I have a var with PHP keywords
(defvar web-mode-php-keywords
'("array" "as" "break" "catch" "continue")
"PHP keywords.")
This var is used for font-locking like this :
(defvar web-mode-php-font-lock-keywords
(list
(cons (concat "\\<\\(" (regexp-opt web-mode-php-keywords) "\\)\\>") 'web-mode-keyword-face)
...
I don't manage to find out a way to let a user add a keyword to the web-mode-php-keywords
list in his .emacs
web-mode-php-font-lock-keywords
relies on web-mode-php-keywords
and trying to alter web-mode-php-keywords
in a hook doesn't work because web-mode-php-font-lock-keywords
is already built
I think I miss something ...
(is this related to eval-after-load
?)
I guess you could do
(setq web-mode-php-keywords '("array" "as" "break" "catch" "continue" "mykeyword1" "mykeyword2"...))
before loading the web-mode file.