From 6d529b658a9bdfde219fce53b9d37623272fa3e8 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sun, 30 Jun 2019 15:02:13 +0000 Subject: [PATCH] C++ Mode: change the default doc comment style from nothing to gtkdoc Also amend a pertinent regular expression. This fixes bug #11865. * lisp/progmodes/cc-vars.el (c-doc-comment-style): Insert an entry for c++-mode, namely gtkdoc. * lisp/progmodes/cc-fonts.el (gtkdoc-font-lock-keywords): Amend the regexp recognizing the introductory "/**" to allow subsequent characters on that line. --- lisp/progmodes/cc-fonts.el | 2 +- lisp/progmodes/cc-vars.el | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 4e81b3b1e20..96c3a6f4a08 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -2798,7 +2798,7 @@ need for `pike-font-lock-extra-types'.") (defconst gtkdoc-font-lock-keywords `((,(lambda (limit) - (c-font-lock-doc-comments "/\\*\\*$" limit + (c-font-lock-doc-comments "/\\*\\*\\([^\\*].*\\)?$" limit gtkdoc-font-lock-doc-comments) (c-font-lock-doc-comments "/\\*< " limit gtkdoc-font-lock-doc-protection) diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 79bd6a92950..54d634780ee 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -563,7 +563,8 @@ variable in a mode hook." (defcustom-c-stylevar c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc) - (c-mode . gtkdoc)) + (c-mode . gtkdoc) + (c++-mode . gtkdoc)) "Specifies documentation comment style(s) to recognize. This is primarily used to fontify doc comments and the markup within them, e.g. Javadoc comments. @@ -573,7 +574,7 @@ comment styles: javadoc -- Javadoc style for \"/** ... */\" comments (default in Java mode). autodoc -- Pike autodoc style for \"//! ...\" comments (default in Pike mode). - gtkdoc -- GtkDoc style for \"/** ... **/\" comments (default in C mode). + gtkdoc -- GtkDoc style for \"/** ... **/\" comments (default in C and C++ modes). The value may also be a list of doc comment styles, in which case all of them are recognized simultaneously (presumably with markup cues -- 2.39.2