From 1b5953e0fd070572ad1d0057000f298d55f804e5 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 9 Oct 2015 16:34:20 -0400 Subject: [PATCH] * lisp/progmodes/cc-mode.el (c-after-font-lock-init): Only *move* our after-change-function, rather than re-adding it if it was removed. --- lisp/progmodes/cc-mode.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 5c68de4b057..1b6a233067c 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1307,8 +1307,9 @@ Note that the style variables are always made local to the buffer." (defun c-after-font-lock-init () ;; Put on `font-lock-mode-hook'. This function ensures our after-change ;; function will get executed before the font-lock one. - (remove-hook 'after-change-functions 'c-after-change t) - (add-hook 'after-change-functions 'c-after-change nil t)) + (when (memq #'c-after-change after-change-functions) + (remove-hook 'after-change-functions #'c-after-change t) + (add-hook 'after-change-functions #'c-after-change nil t))) (defun c-font-lock-init () "Set up the font-lock variables for using the font-lock support in CC Mode. -- 2.39.2