From b25d58c956a9fcd2b81b804699573ea851bd8fde Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Tue, 2 Jul 2019 12:33:01 +0000 Subject: CC Mode: Improve handling of unbalanced strings * lisp/progmodes/cc-fonts.el (c-before-font-lock-functions): Add function c-after-change-escape-NL-in-string into value for most languages. * lisp/progmodes/cc-mode.el (c-after-change-escape-NL-in-string): New function. (c-before-change-check-unbalanced-strings): Handle the making and breaking of escaped newlines, by removal or addition of text. --- lisp/progmodes/cc-langs.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp/progmodes/cc-langs.el') diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 2fcd6acf51f..153d3fc2608 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -478,7 +478,7 @@ so that all identifiers are recognized as words.") (list fs))) "If non-nil, a list of functions called from c-before-change-hook. Typically these will record enough state to allow -`c-before-font-lock-function' to extend the region to fontify, +`c-before-font-lock-functions' to extend the region to fontify, and may do such things as removing text-properties which must be recalculated. @@ -497,15 +497,18 @@ parameters \(point-min) and \(point-max).") ;; For documentation see the following c-lang-defvar of the same name. ;; The value here may be a list of functions or a single function. t '(c-depropertize-new-text + c-after-change-escape-NL-in-string c-after-change-mark-abnormal-strings c-change-expand-fl-region) (c objc) '(c-depropertize-new-text + c-after-change-escape-NL-in-string c-parse-quotes-after-change c-after-change-mark-abnormal-strings c-extend-font-lock-region-for-macros c-neutralize-syntax-in-CPP c-change-expand-fl-region) c++ '(c-depropertize-new-text + c-after-change-escape-NL-in-string c-after-change-unmark-raw-strings c-parse-quotes-after-change c-after-change-mark-abnormal-strings @@ -514,6 +517,7 @@ parameters \(point-min) and \(point-max).") c-restore-<>-properties c-change-expand-fl-region) java '(c-depropertize-new-text + c-after-change-escape-NL-in-string c-parse-quotes-after-change c-after-change-mark-abnormal-strings c-restore-<>-properties -- cgit v1.2.3