aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2017-12-21 17:18:40 +0000
committerAlan Mackenzie2017-12-21 17:18:40 +0000
commit293720e930ac33e007d3402b677d6c482d0a3dbf (patch)
treedb3d3e93829f04188ccd5de67f9c6441eaa63d9c
parent8a73b7003e5db5a57550270602841d9ee2194cf5 (diff)
downloademacs-293720e930ac33e007d3402b677d6c482d0a3dbf.tar.gz
emacs-293720e930ac33e007d3402b677d6c482d0a3dbf.zip
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.
-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'.")
2670 ;; This function might do hidden buffer changes. 2670 ;; This function might do hidden buffer changes.
2671 2671
2672 (let (comment-beg region-beg) 2672 (let (comment-beg region-beg)
2673 (if (eq (get-text-property (point) 'face) 2673 (if (memq (get-text-property (point) 'face)
2674 'font-lock-comment-face) 2674 '(font-lock-comment-face font-lock-comment-delimiter-face))
2675 ;; Handle the case when the fontified region starts inside a 2675 ;; Handle the case when the fontified region starts inside a
2676 ;; comment. 2676 ;; comment.
2677 (let ((start (c-literal-start))) 2677 (let ((start (c-literal-start)))
@@ -2691,8 +2691,15 @@ need for `pike-font-lock-extra-types'.")
2691 (or (not (c-got-face-at comment-beg 2691 (or (not (c-got-face-at comment-beg
2692 c-literal-faces)) 2692 c-literal-faces))
2693 (and (/= comment-beg (point-min)) 2693 (and (/= comment-beg (point-min))
2694 ;; Cheap check which is unreliable (the previous
2695 ;; character could be the end of a previous
2696 ;; comment).
2694 (c-got-face-at (1- comment-beg) 2697 (c-got-face-at (1- comment-beg)
2695 c-literal-faces)))) 2698 c-literal-faces)
2699 ;; Expensive reliable check.
2700 (save-excursion
2701 (goto-char comment-beg)
2702 (c-in-literal)))))
2696 (setq comment-beg nil)) 2703 (setq comment-beg nil))
2697 (setq region-beg comment-beg)) 2704 (setq region-beg comment-beg))
2698 2705