I'm trying to write a derived mode from fundamental-mode. Assuming that I have this regexp : A ((foo)bar)? B
, how can I tell emacs to use the following faces ?
font-lock-keyword-face
onA
font-lock-warning-face
onfoo
(but notbar
)font-lock-constant-face
onB
I have tried to use this following code :
(defvar myregexp
"\\(A\\) \\(?:\\(foo\\)bar \\)?\\(B\\)")
(setq mylang-font-lock-keywords `(
(, myregex 1 font-lock-keyword-face)
(, myregex 2 font-lock-warning-face)
(, myregex 3 font-lock-constant-face)
))
But it does not work with the string A B
(emacs report a missing capture).