1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

CC Mode: Minor corrections and tidy ups for cache invalidation

These cache variables are c-lit-pos-cache-limit,
c-semi-near-cache-limit, c-full-near-cache-limit, and
c-state-cache-invalid-pos.

* lisp/progmodes/cc-awk.el
(c-awk-set-string-regexp-syntax-table-properties): Invalidate
the caches after changing the 'syntax-table property.

* lisp/progmodes/cc-defs.el (c-put-string-fence-trim-caches):
New macro.
(c-unmark-<-or->-as-paren): New name for c-unmark-<->-as-paren.
(Also renamed throughout CC Mode)

* lisp/progmodes/cc-engine.el (c-propertize-ml-string-opener):
Add missing cache invalidation.

* lisp/progmodes/cc-mode.el (c-neutralize-CPP-line): Remove
syntax-table properties from < and > as needed.
(c-put-syn-tab): Add missing cache invalidation.
This commit is contained in:
Alan Mackenzie 2024-12-28 17:16:04 +00:00
parent e32484547d
commit 0334b0743f
4 changed files with 39 additions and 29 deletions

View file

@ -754,15 +754,15 @@
(if (eq (char-after beg) ?_) (setq beg (1+ beg)))
;; First put the properties on the delimiters.
(cond ((eq end (point-max)) ; string/regexp terminated by EOB
(c-put-string-fence beg))
(cond ((eq end (point-max)) ; string/regexp terminated by EOB
(c-put-string-fence-trim-caches beg))
((/= (char-after beg) (char-after end)) ; missing end delimiter
(c-put-string-fence beg)
(c-put-string-fence-trim-caches beg)
(c-put-string-fence end))
((eq (char-after beg) ?/) ; Properly bracketed regexp
(c-put-char-property beg 'syntax-table '(7)) ; (7) = "string"
(c-put-syntax-table-trim-caches end '(7)))
(t)) ; Properly bracketed string: Nothing to do.
(c-put-syntax-table-trim-caches beg '(7)) ; (7) = "string"
(c-put-char-property end 'syntax-table '(7)))
(t)) ; Properly bracketed string: Nothing to do.
;; Now change the properties of any escaped "s in the string to punctuation.
(save-excursion
(goto-char (1+ beg))