emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] comment-cache b80bcc6 2/2: Stop CC Mode using `category' t


From: Alan Mackenzie
Subject: [Emacs-diffs] comment-cache b80bcc6 2/2: Stop CC Mode using `category' text properties. Enhance `c-save-buffer-state'
Date: Tue, 08 Mar 2016 17:33:52 +0000

branch: comment-cache
commit b80bcc62310f68b9ea712d645f0f14671ff53023
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Stop CC Mode using `category' text properties.  Enhance 
`c-save-buffer-state'
    
    * 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 |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 2056f39..30bb8f1 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]