I have a templating css file type that allows comments to start with '##' No matter what I try though It doesn't seem to recognize this in my derived-mode. Here is what i have so far
(define-derived-mode cheetah-css-mode css-mode "cheetah-css"
(make-face 'cheetah-css-variable-face)
(font-lock-add-keywords
nil
'(("\\(##.*\\)\n" font-lock-comment-face)) (font-lock-mode 1)))
What you actually want to do is modify the syntax table for your mode to identify ##
as a comment. Then Emacs will be able to treat it as such in all respects (and not just highlighting).
See:
(info "(elisp) Syntax Descriptors")
RET(info "(elisp) Syntax Flags")
RET(info "(elisp) Syntax Class Table")
RETTry this in your derived mode definition:
(modify-syntax-entry ?# "' 12b" cheetah-css-mode-syntax-table)
(modify-syntax-entry ?\n "> b" cheetah-css-mode-syntax-table)