I have implemented the solution of Yasushi Shoji in a previous thread -- Colorizing `functions/variables' within comments in `c-mode' -- to highlight Lisp function/variable names in
c-mode comments that begin with a back-tick and end with a single quote:
/* See the doc-string for `pos-visible-in-window-p'. */
c-font-lock-doc-comments unfortunately does away with the ability to highlight the comment beginning/ending with
font-lock-comment-delimiter-face, which is a member of
c-literal-faces. What happens is that the entire comment (except for the function/variable) gets highlighted with
The unsophisticated approach is to redefine
c-font-lock-doc-comments by removing or commenting out the offending code:
(c-put-font-lock-face region-beg region-end c-doc-face-name)
However, doing so will break the intended functionality for the three (3) other forms of predefined
c-doc-comment-style -- i.e., javadoc, autodoc, and gtkdoc.
I am looking for a more sophisticated means to preserve the
font-lock-comment-delimiter-face for comment beginning/ending and preserve the
font-lock-comment-face for everything except the function/variable that is highlighted with Yasushi's solution.
The prior solution of Yasushi is as follows:
(require 'cc-mode) (setq yashi-font-lock-doc-comments (let ((symbol "[a-zA-Z0-9_-]+")) `((,(concat "`" symbol "'") 0 ,c-doc-markup-face-name prepend nil)) )) (setq yashi-font-lock-keywords `((,(lambda (limit) (c-font-lock-doc-comments "/\\*" limit yashi-font-lock-doc-comments) )))) (add-hook 'c-mode-hook (lambda () (setq c-doc-comment-style '((c-mode . yashi)))))