I am trying to set up a major mode in Emacs where I would like to highlight certain keywords. Using a template from this page: http://ergoemacs.org/emacs/elisp_syntax_coloring.html I tried:
(setq testing-font-lock-keywords
`((font-lock-keyword-face)
))
(define-derived-mode testing-mode fundamental-mode
"testing file mode"
"Major mode for editing test files"
(setq font-lock-defaults '(testing-font-lock-keywords))
(setq mode-name "testing")
)
(provide 'testing-mode)
If I use this mode on a simple test file, and type "hello"
the text hello
is marked in different color. That is, any text within double quotes is highlighted. Why is this happening?
I think it is related to the variable font-lock-keyword-face
. But if I type C-h v and font-lock-keyword-face
it says:
font-lock-keyword-face is a variable defined in `font-lock.el'.
Its value is font-lock-keyword-face
Update
It seems like it is not related to font-lock-keyword-face
anyway, since defining testing-font-lock-keywords
like:
(setq test-keywords '("TEST"))
(setq testing-font-lock-keywords
`((,test-keywords)))
gives the same behavior.
This is directed by variable `font-lock-syntactic-face-function'