cc-mode
doesn't have support for reStructuredText, and I don't know any simple way to reuse rst-mode
's highlighting in cc-mode
. I think you'll have to write the appropriate code for cc-mode
yourself.
The documentation for c-doc-comment-style
has this to say:
You can also write your own doc comment fontification support to use with c-doc-comment-style
: Supply a variable or function *-font-lock-keywords
where *
is the name you want to use in c-doc-comment-style
. If it’s a variable, it’s prepended to font-lock-keywords
. If it’s a function, it’s called at mode initialization and the result is prepended. [...] It is even possible, to a limited extent, to fontify constructs inside a doc comment with other faces. For an example, see pike autodoc comment style towards the end of cc-fonts-el
.
You can make up a name like rstdoc
for use as the value of c-doc-comment-style
and implement it by defining a couple of variables. The existing definitions, as well as the regexps in rst-mode
, will probably be useful as a source of examples.
Furthermore, I'd like to be able to use different styles for different projects
This one is easy. You can set c-doc-comment-style
as a directory-local or file-local variable. See the commands add-dir-local-variable
and add-file-local-variable
.