summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-defs.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-11-09 12:09:30 +0000
committerAlan Mackenzie <acm@muc.de>2019-11-09 12:09:30 +0000
commitb293aa91bcc7f553ffbc6c67027f3c86d06ffbd7 (patch)
tree39f019da4ce7a41d1367c01f590487b529bad2a3 /lisp/progmodes/cc-defs.el
parent6daa80d04e575a27f53f60f5fafd7fcba39b4b2a (diff)
downloademacs-b293aa91bcc7f553ffbc6c67027f3c86d06ffbd7.tar.gz
emacs-b293aa91bcc7f553ffbc6c67027f3c86d06ffbd7.tar.bz2
emacs-b293aa91bcc7f553ffbc6c67027f3c86d06ffbd7.zip
CC Mode. Allow fontification of "wrong" style comments with warning face.
This fixes bug #4192. * etc/NEWS: Add a new entry. * lisp/progmodes/cc-defs.el (c-font-lock-flush): New macro. * lisp/progmodes/cc-cmds.el (c-toggle-comment-style): On toggling the comment style, invoke c-font-lock-flush when c-mark-wrong-style-of-comment is non-nil, to cause that marking to be done instead on the other style of comment. * lisp/progmodes/cc-fonts.el (c-maybe-font-lock-wrong-style-comments): New function. (c-cpp-matchers): Call c-maybe-font-lock-wrong-style-comments when appropriate. * lisp/progmodes/cc-vars.el (c-mark-wrong-style-of-comment): New customizable option. * doc/misc/cc-mode.texi (top level, Indentation Commands, Guessing the Style, Custom Macros): For some opening quote marks, correct '' to ``. (Minor Modes): Add an xref to the new page "Wrong Comment Style" in a footnote. (Wrong Comment Style): New page.
Diffstat (limited to 'lisp/progmodes/cc-defs.el')
-rw-r--r--lisp/progmodes/cc-defs.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index e9a3e16db36..6a9371e6f19 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -219,6 +219,13 @@ This variant works around bugs in `eval-when-compile' in various
`(cl-delete-duplicates ,cl-seq ,@cl-keys)
`(delete-duplicates ,cl-seq ,@cl-keys))))
+(defmacro c-font-lock-flush (beg end)
+ "Declare the region BEG...END's fontification as out-of-date.
+On XEmacs and older Emacsen, this refontifies that region immediately."
+ (if (fboundp 'font-lock-flush)
+ `(font-lock-flush ,beg ,end)
+ `(font-lock-fontify-region ,beg ,end)))
+
(defmacro c-point (position &optional point)
"Return the value of certain commonly referenced POSITIONs relative to POINT.
The current point is used if POINT isn't specified. POSITION can be