]> git.eshelyaron.com Git - emacs.git/commitdiff
On leaving CC Mode, clean up by removing character properties.
authorAlan Mackenzie <acm@muc.de>
Sun, 7 Feb 2016 15:06:43 +0000 (15:06 +0000)
committerAlan Mackenzie <acm@muc.de>
Sun, 7 Feb 2016 15:06:43 +0000 (15:06 +0000)
* lisp/progmodes/cc-mode.el (c-leave-cc-mode-mode): Remove from the buffer
all instances of the text properties/extents category, syntax-table,
c-is-sws, c-in-sws, c-type, and c-awk-NL-prop.

lisp/progmodes/cc-mode.el

index 738870b727ae802dbebd1069f5041a2c1bfb193a..58aebf8b410b52ea4333a235a75846092d12731f 100644 (file)
 ;; derived-mode-ex.el>.
 
 (defun c-leave-cc-mode-mode ()
-  (setq c-buffer-is-cc-mode nil))
+  (when c-buffer-is-cc-mode
+    (save-restriction
+      (widen)
+      (c-save-buffer-state ()
+       (c-clear-char-properties (point-min) (point-max) 'category)
+       (c-clear-char-properties (point-min) (point-max) 'syntax-table)
+       (c-clear-char-properties (point-min) (point-max) 'c-is-sws)
+       (c-clear-char-properties (point-min) (point-max) 'c-in-sws)
+       (c-clear-char-properties (point-min) (point-max) 'c-type)
+       (if (c-major-mode-is 'awk-mode)
+           (c-clear-char-properties (point-min) (point-max) 'c-awk-NL-prop))))
+    (setq c-buffer-is-cc-mode nil)))
 
 (defun c-init-language-vars-for (mode)
   "Initialize the language variables for one of the language modes