In my previous question I asked about complex
comment-start sequence and I think I figured it out, but now I have another problem. Let say we have this mode:
(defconst test-font-lock-keywords '(("\\<\\(nop\\|end\\)\\>" . font-lock-keyword-face)) "Expressions to highlight.") (defvar test-syntax-table (let ((st (make-syntax-table))) (modify-syntax-entry ?\; "<" st) (modify-syntax-entry ?\n ">;" st) st) "Syntax table.") (defun test-syntax-propertize (start end) (funcall (syntax-propertize-rules ("\\<\\(s\\)tart\\>" (1 "< b")) ("\\<en\\(d\\)\\>" (1 "> b"))) start end)) (define-derived-mode test-mode prog-mode "Test" (setq-local comment-start ";") (setq-local font-lock-defaults '(test-font-lock-keywords)) (setq-local syntax-propertize-function #'test-syntax-propertize) "Test major mode.")
So we have two instructions
end is also set as comment ender and if there is no
end I'd like to set
keyword-face but it does not work,
end instruction don't change color at all. I understand why it's happening, but I'm new in elisp and don't know how things work in detail so I can not fix it. Any advice will be appreciated.