summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2017-12-21 17:18:40 +0000
committerAlan Mackenzie <acm@muc.de>2017-12-21 17:18:40 +0000
commit293720e930ac33e007d3402b677d6c482d0a3dbf (patch)
treedb3d3e93829f04188ccd5de67f9c6441eaa63d9c /lisp
parent8a73b7003e5db5a57550270602841d9ee2194cf5 (diff)
downloademacs-293720e930ac33e007d3402b677d6c482d0a3dbf.tar.gz
Fix loss of documentation face in certain CC Mode doc comment situations
* lisp/progmodes/cc-fonts.el (c-font-lock-doc-comments): Take into account the possibility of font-lock-comment-delimiter-face. Test rigorously for "/**" (etc.) being itself inside a literal, rather than just depending on the face of the previous character.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/cc-fonts.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 7b99c2f54e5..83038e07ca6 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -2670,8 +2670,8 @@ need for `pike-font-lock-extra-types'.")
;; This function might do hidden buffer changes.
(let (comment-beg region-beg)
- (if (eq (get-text-property (point) 'face)
- 'font-lock-comment-face)
+ (if (memq (get-text-property (point) 'face)
+ '(font-lock-comment-face font-lock-comment-delimiter-face))
;; Handle the case when the fontified region starts inside a
;; comment.
(let ((start (c-literal-start)))
@@ -2691,8 +2691,15 @@ need for `pike-font-lock-extra-types'.")
(or (not (c-got-face-at comment-beg
c-literal-faces))
(and (/= comment-beg (point-min))
+ ;; Cheap check which is unreliable (the previous
+ ;; character could be the end of a previous
+ ;; comment).
(c-got-face-at (1- comment-beg)
- c-literal-faces))))
+ c-literal-faces)
+ ;; Expensive reliable check.
+ (save-excursion
+ (goto-char comment-beg)
+ (c-in-literal)))))
(setq comment-beg nil))
(setq region-beg comment-beg))