I found that font-lock-add-keywords is the key but I cannot find how to add a pattern. For example, in clojure;
(defn a-function-name [argument vector]
...)
a-function-name is highlighted becuase it's after defn and before [argument vector]. How can I write a rule for this?
(font-lock-add-keywords 'lisp-mode XXXXX)
I cannot write XXXXX
part for myself.
=======================
Thank you to all of you :-) Yes, I can find clue in docs and clojure-mode.el as of you said.
Here is what I do and it works well (at least for me)
(font-lock-add-keywords
'lisp-mode
'(("(\\(@defn\\)\\>[ \r\t\n]*\\(\\sw+\\)+\\>?"
(2 'font-lock-function-name-face))))
Why I need this is that I define some macros and emacs does not highlight them properly.
To add to what @juanleon said: See the Elisp manual, node Search-Based Fontification
for information about font-lock-keywords
. That will help you "write the XXXXX part for yourself."
Then, as @juanleon said, try something and ask for more help here if it doesn't work. Code tried gets help.