]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/cc-mode.el (c-after-font-lock-init): Only *move*
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 9 Oct 2015 20:34:20 +0000 (16:34 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 9 Oct 2015 20:34:20 +0000 (16:34 -0400)
our after-change-function, rather than re-adding it if it was removed.

lisp/progmodes/cc-mode.el

index 5c68de4b057dccbd009e4c1bf3a1565844aed4b2..1b6a233067cdaa3d88bc95b2b6efbc1bb862cdaa 100644 (file)
@@ -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.