]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-defs.el
-
[gnu-emacs] / lisp / progmodes / cc-defs.el
index 2056f3907b8152492c5ac865921991bc03883f9b..7365f695f3b92e9d303b68cffcbc6d0632d675b1 100644 (file)
@@ -1260,7 +1260,8 @@ been put there by c-put-char-property.  POINT remains unchanged."
 (def-edebug-spec c-clear-char-property t)
 (def-edebug-spec c-clear-char-properties t)
 (def-edebug-spec c-put-overlay t)
-(def-edebug-spec c-delete-overlay t) ;))
+(def-edebug-spec c-delete-overlay t)
+(def-edebug-spec c-self-bind-state-cache t);))
 
 \f
 ;;; Functions.
@@ -1399,6 +1400,26 @@ been put there by c-put-char-property.  POINT remains unchanged."
        (save-restriction
         (widen)
         (c-set-cpp-delimiters ,beg ,end)))))
+
+(defmacro c-self-bind-state-cache (&rest forms)
+  ;; Bind the state cache to itself and execute the FORMS.  It is assumed that no
+  ;; buffer changes will happen in FORMS, and no hidden buffer changes which could
+  ;; affect the parsing will be made by FORMS.
+  `(let ((c-state-cache (copy-tree c-state-cache))
+        (c-state-cache-good-pos c-state-cache-good-pos)
+        ;(c-state-nonlit-pos-cache (copy-tree c-state-nonlit-pos-cache))
+        ;(c-state-nonlit-pos-cache-limit c-state-nonlit-pos-cache-limit)
+        ;(c-state-semi-nonlit-pos-cache (copy-treec c-state-semi-nonlit-pos-cache))
+        ;(c-state-semi-nonlit-pos-cache-limit c-state-semi-nonlit-pos-cache)
+        (c-state-brace-pair-desert (copy-tree c-state-brace-pair-desert))
+        (c-state-point-min c-state-point-min)
+        (c-state-point-min-lit-type c-state-point-min-lit-type)
+        (c-state-point-min-lit-start c-state-point-min-lit-start)
+        (c-state-min-scan-pos c-state-min-scan-pos)
+        (c-state-old-cpp-beg c-state-old-cpp-beg)
+        (c-state-old-cpp-end c-state-old-cpp-end))
+     ,@forms))
+
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; The following macros are to be used only in `c-parse-state' and its