>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Wed, 27 Oct 2021 21:13:24 -0700 Subject: [PATCH 14/28] Register erc-kill-buffer-function locally * lisp/erc/erc.el (erc-kill-buffer-function): don't add hook when loading file. Not that it matters, but this would run twice because of the erc{-backend} dependency cycle. Move to major-mode setup and make buffer-local instead. Depends on tests in Bug#48598. --- lisp/erc/erc.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 35d56c3b82..3a87d0d846 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -1538,6 +1538,7 @@ erc-mode (setq-local paragraph-start (concat "\\(" (regexp-quote (erc-prompt)) "\\)")) (setq-local completion-ignore-case t) + (add-hook 'kill-buffer-hook #'erc-kill-buffer-function nil t) (add-hook 'completion-at-point-functions #'erc-complete-word-at-point nil t)) ;; activation @@ -7126,9 +7127,6 @@ erc-format-message ;;; Various hook functions -;; FIXME: Don't set the hook globally! -(add-hook 'kill-buffer-hook #'erc-kill-buffer-function) - (defcustom erc-kill-server-hook '(erc-kill-server erc--shrink-ids-and-buffer-names) "Invoked whenever a live server buffer is killed via `kill-buffer'." -- 2.31.1