From b80bcc62310f68b9ea712d645f0f14671ff53023 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Tue, 8 Mar 2016 17:34:21 +0000 Subject: [PATCH] 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 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 2056f3907b8..30bb8f1ee2d 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 -- 2.39.5