From: Alan Mackenzie Date: Sun, 7 Feb 2016 15:06:43 +0000 (+0000) Subject: On leaving CC Mode, clean up by removing character properties. X-Git-Tag: emacs-26.0.90~2716 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7149cc54e7e8bb2266f44221d7f4b4bed70579f3;p=emacs.git On leaving CC Mode, clean up by removing character properties. * 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. --- diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 738870b727a..58aebf8b410 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -141,7 +141,18 @@ ;; 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