From: Alan Mackenzie Date: Sat, 27 Jul 2019 12:55:53 +0000 (+0000) Subject: CC Mode: Stop /**/ spuriously fontifying as a doc comment under gtkdoc X-Git-Tag: emacs-27.0.90~1817^2~74 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2f646633e0e29201c8fa0e39f4baec3a14491639;p=emacs.git CC Mode: Stop /**/ spuriously fontifying as a doc comment under gtkdoc Also fix infinite loops by correcting two regexps. * lisp/progmodes/cc-langs.el (c-last-c-comment-end-on-line-re) (c-last-open-c-comment-start-on-line-re): Correct the regexp fragments "\\*+[^/]" to "\\*+\\([^*/]\\|$\\)". * lisp/progmodes/cc-fonts.el (gtkdoc-font-lock-keywords): Disallow /**/ for doc comment fontification. --- diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index d8842c8184f..f58caf2f1ae 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 "/\\*\\*\\([^*\n\r].*\\)?$" limit + (c-font-lock-doc-comments "/\\*\\*\\([^*/\n\r].*\\)?$" limit gtkdoc-font-lock-doc-comments) (c-font-lock-doc-comments "/\\*< " limit gtkdoc-font-lock-doc-protection) diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 8a4f8f59515..72c0fdd0d2d 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1652,7 +1652,7 @@ backslash." current line, if any, or nil in those languages without block comments. When a match is found, submatch 1 contains the comment ender." - t "\\(\\*/\\)\\([^*]\\|\\*+[^/]\\)*$" + t "\\(\\*/\\)\\([^*]\\|\\*+\\([^*/]\\|$\\)\\)*$" awk nil) (c-lang-defvar c-last-c-comment-end-on-line-re (c-lang-const c-last-c-comment-end-on-line-re)) @@ -1662,7 +1662,7 @@ ender." current ine, if any, or nil in those languages without block comments. When a match is found, submatch 1 contains the comment starter." - t "\\(/\\*\\)\\([^*]\\|\\*+[^/]\\)*$" + t "\\(/\\*\\)\\([^*]\\|\\*+\\([^*/]\\|$\\)\\)*$" awk nil) (c-lang-defvar c-last-open-c-comment-start-on-line-re (c-lang-const c-last-open-c-comment-start-on-line-re))