As far as I understand there is syntax flags only for comment delimiters made up of two characters but if I have comment delimiters of length greater than two characters is it possible to change syntax table accordingly? And if not, how can I resolve this kind of situation? Just change colors and indentation of comment block and forget about syntax table?
1 Answer
So in case if someone seeks for an answer, as @DoMiNeLa10 suggested, I looked in html-mode and ruby-mode and realised that we can set syntax-propertize-function
which is
intended to be used by major modes to install a function which applies syntax-table properties in some mode-appropriate way.
So it would be something like this:
(setq-local syntax-propertize-function
(syntax-propertize-rules ("complex regexp comment-start" (0 "< b")))
(syntax-propertize-rules ("complex regexp comment-end" (0 "> b"))))
In case if regexp contains some groups you need to precise which group to use starting with 1 (0 is reserved for whole expression).
-
After setting the
syntax-propertize-function
with the above, should the comments getfont-lock-comment-face
applied? emacs.stackexchange.com/questions/69265/… Nov 7, 2021 at 18:47
html-mode
, which uses more complex comments.