]> git.eshelyaron.com Git - emacs.git/commitdiff
Stop CC Mode using `category' text properties. Enhance `c-save-buffer-state'
authorAlan Mackenzie <acm@muc.de>
Tue, 8 Mar 2016 17:34:21 +0000 (17:34 +0000)
committerAlan Mackenzie <acm@muc.de>
Tue, 8 Mar 2016 17:34:21 +0000 (17:34 +0000)
* lisp/progmodes/cc-defs.el (c-use-category): Set to nil when
'comment-depth-hwm' exists.
(c-save-buffer-state): Bind `inhibit-modification-hooks' to non-nil.

lisp/progmodes/cc-defs.el

index 2056f3907b8152492c5ac865921991bc03883f9b..30bb8f1ee2d1faa1ea9b55730c5f7fc6c1430b8e 100644 (file)
@@ -375,18 +375,19 @@ to it is returned.  This function does not modify the point or the mark."
   ;; Constant to decide at compilation time whether to use category
   ;; properties.  Currently (2010-03) they're available only on GNU Emacs.
   (defconst c-use-category
-    (with-temp-buffer
-      (let ((parse-sexp-lookup-properties t)
-           (lookup-syntax-properties t))
-        (set-syntax-table (make-syntax-table))
-        (insert "<()>")
-        (put-text-property (point-min) (1+ (point-min))
-                          'category 'c-<-as-paren-syntax)
-        (put-text-property (+ 3 (point-min)) (+ 4 (point-min))
-                          'category 'c->-as-paren-syntax)
-        (goto-char (point-min))
-        (forward-sexp)
-        (= (point) (+ 4 (point-min)))))))
+    (and (not (boundp 'comment-depth-hwm))
+        (with-temp-buffer
+          (let ((parse-sexp-lookup-properties t)
+                (lookup-syntax-properties t))
+            (set-syntax-table (make-syntax-table))
+            (insert "<()>")
+            (put-text-property (point-min) (1+ (point-min))
+                               'category 'c-<-as-paren-syntax)
+            (put-text-property (+ 3 (point-min)) (+ 4 (point-min))
+                               'category 'c->-as-paren-syntax)
+            (goto-char (point-min))
+            (forward-sexp)
+            (= (point) (+ 4 (point-min))))))))
 
 (defvar c-use-extents)
 
@@ -498,6 +499,7 @@ The return value is the value of the last form in BODY."
       `(with-silent-modifications (let* ,varlist ,@body))
     `(let* ((modified (buffer-modified-p)) (buffer-undo-list t)
            (inhibit-read-only t) (inhibit-point-motion-hooks t)
+           (inhibit-modification-hooks t)
            before-change-functions after-change-functions
            deactivate-mark
            buffer-file-name buffer-file-truename ; Prevent primitives checking