emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 83bbb48: CC Mode - use font-lock-comment-delimiter-


From: Alan Mackenzie
Subject: [Emacs-diffs] master 83bbb48: CC Mode - use font-lock-comment-delimiter-face on block comment end delimiters
Date: Sun, 30 Dec 2018 13:49:01 -0500 (EST)

branch: master
commit 83bbb48142e5f9714408dd628d244678eff2dc11
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    CC Mode - use font-lock-comment-delimiter-face on block comment end 
delimiters
    
    In particular when the default comment type is currently line comments.  Do
    this by setting font-lock-comment-end-skip.
    
    * lisp/progmodes/cc-cmds.el (c-font-lock-comment-end-skip): New lang const.
    (font-lock-comment-end-skip): New c-lang-setvar.
---
 lisp/progmodes/cc-langs.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 8c148e5..4bd4f6d 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1529,6 +1529,17 @@ properly."
 (c-lang-defvar c-block-comment-ender-regexp
               (c-lang-const c-block-comment-ender-regexp))
 
+(c-lang-defconst c-font-lock-comment-end-skip
+  ;; Regexp which matches whitespace followed by the end of a block comment
+  ;; (if such exists in the language).  This is used by font lock to determine
+  ;; the portion of the end of a comment to fontify with
+  ;; `font-lock-comment-delimiter-face'.
+  t (if (c-lang-const c-block-comment-ender)
+       (concat "[ \t]*" (c-lang-const c-block-comment-ender-regexp))
+      "a\\`"))                         ; Doesn't match anything.
+(c-lang-setvar font-lock-comment-end-skip
+              (c-lang-const c-font-lock-comment-end-skip))
+
 (c-lang-defconst c-comment-start-regexp
   ;; Regexp to match the start of any type of comment.
   t (let ((re (c-make-keywords-re nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]