From 3451370807345d6229782abf9dd8b9dc53d12d41 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Mon, 28 Oct 2024 15:58:04 +0000 Subject: [PATCH] CC Mode: Add/remove defun buffer locally to post-command-hook 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index ebe8b8e45ba..058be1c63e3 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -186,8 +186,7 @@ (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) -- 2.39.5