From: Stefan Monnier Date: Fri, 9 Oct 2015 20:34:20 +0000 (-0400) Subject: * lisp/progmodes/cc-mode.el (c-after-font-lock-init): Only *move* X-Git-Tag: emacs-25.0.90~1180 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1b5953e0fd070572ad1d0057000f298d55f804e5;p=emacs.git * 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. --- 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.