diff options
author | Alan Mackenzie <acm@muc.de> | 2020-12-30 18:31:56 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2020-12-30 18:31:56 +0000 |
commit | 059f1863a268d6e9bd2c9b8e05e8546d4dd8f50b (patch) | |
tree | b5b18fface6a5d732b9ee7a3bbcc3e52d24d3508 | |
parent | c4c8da67e85c92a296426e3fd39a15ffb80b0b41 (diff) | |
download | emacs-059f1863a268d6e9bd2c9b8e05e8546d4dd8f50b.tar.gz |
CC Mode: correct the handling of empty strings
In particular, have the macro cache invalidated after its last use in
c-before-change.
* lisp/progmodes/cc-langs.el (c-get-state-before-change-functions): Remove
c-invalidate-macro-cache from the entries it's in, moving it to....
* lisp/progmodes/cc-mode.el (c-before-change): Call c-invalidate-macro-cache
directly from the functions, after the call to c-invalidate-state-cache.
-rw-r--r-- | lisp/progmodes/cc-langs.el | 2 | ||||
-rw-r--r-- | lisp/progmodes/cc-mode.el | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index b10a085552d..c3cd81e1e82 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -457,13 +457,11 @@ so that all identifiers are recognized as words.") c-before-change-check-raw-strings c-before-change-check-<>-operators c-depropertize-CPP - c-invalidate-macro-cache c-truncate-bs-cache c-before-change-check-unbalanced-strings c-parse-quotes-before-change) (c objc) '(c-extend-region-for-CPP c-depropertize-CPP - c-invalidate-macro-cache c-truncate-bs-cache c-before-change-check-unbalanced-strings c-parse-quotes-before-change) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 2f1885e5b61..d4c868dd1fc 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2065,7 +2065,11 @@ Note that this is a strict tail, so won't match, e.g. \"0x....\".") ;; The following must be done here rather than in `c-after-change' ;; because newly inserted parens would foul up the invalidation ;; algorithm. - (c-invalidate-state-cache beg))) + (c-invalidate-state-cache beg) + ;; The following must happen after the previous, which likely alters + ;; the macro cache. + (when c-opt-cpp-symbol + (c-invalidate-macro-cache beg end)))) (defvar c-in-after-change-fontification nil) (make-variable-buffer-local 'c-in-after-change-fontification) |