]> git.eshelyaron.com Git - emacs.git/commitdiff
CC Mode: Add/remove defun buffer locally to post-command-hook
authorAlan Mackenzie <acm@muc.de>
Mon, 28 Oct 2024 15:58:04 +0000 (15:58 +0000)
committerEshel Yaron <me@eshelyaron.com>
Tue, 29 Oct 2024 09:57:34 +0000 (10:57 +0100)
Also remove no longer existing hook.

* lisp/progmodes/cc-mode (c-leave-cc-mode-mode): remove-hook
c-post-command buffer locally.  Delete removal of non-existent
c-post-gc-hook.
(c-basic-common-init): add-hook c-post-command buffer locally.

(cherry picked from commit c05a13ef0dc69497e275b627dbc8e2b25ece7711)

lisp/progmodes/cc-mode.el

index ebe8b8e45ba34c8f19c319ce795d630d2d170b2f..058be1c63e3049e88b634156d88cc5c565622130 100644 (file)
                     (with-current-buffer b
                       c-buffer-is-cc-mode))
                (throw 'found nil)))
-         (remove-hook 'post-command-hook 'c-post-command)
-         (remove-hook 'post-gc-hook 'c-post-gc-hook)))
+         (remove-hook 'post-command-hook 'c-post-command t)))
       (c-save-buffer-state ()
        (c-clear-char-properties (point-min) (point-max) 'category)
        (c-clear-char-properties (point-min) (point-max) 'syntax-table)
@@ -748,7 +747,7 @@ that requires a literal mode spec at compile time."
   ;; would do since font-lock uses a(n implicit) depth of 0) so we don't need
   ;; c-after-font-lock-init.
   (add-hook 'after-change-functions 'c-after-change nil t)
-  (add-hook 'post-command-hook 'c-post-command)
+  (add-hook 'post-command-hook 'c-post-command nil t)
 
   (when (boundp 'font-lock-extend-after-change-region-function)
     (set (make-local-variable 'font-lock-extend-after-change-region-function)