Function: erc-kill-buffer-function

erc-kill-buffer-function is a byte-compiled function defined in erc.el.gz.

Signature

(erc-kill-buffer-function)

Documentation

Function to call when an ERC buffer is killed.

This function should be on kill-buffer-hook. When the current buffer is in erc-mode, this function will run one of the following hooks: erc-kill-server-hook if the server buffer was killed, erc-kill-channel-hook if a channel buffer was killed, or erc-kill-buffer-hook if any other buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
;; FIXME alias and deprecate current *-function suffixed name.
(defun erc-kill-buffer-function ()
  "Function to call when an ERC buffer is killed.
This function should be on `kill-buffer-hook'.
When the current buffer is in `erc-mode', this function will run
one of the following hooks:
`erc-kill-server-hook' if the server buffer was killed,
`erc-kill-channel-hook' if a channel buffer was killed,
or `erc-kill-buffer-hook' if any other buffer."
  (when (eq major-mode 'erc-mode)
    (when-let ((erc--target)
               (nick (erc-current-nick)))
      (erc--remove-channel-users-but nick))
    (cond
     ((eq (erc-server-buffer) (current-buffer))
      (run-hooks 'erc-kill-server-hook))
     ((erc--target-channel-p erc--target)
      (run-hooks 'erc-kill-channel-hook))
     (t
      (run-hooks 'erc-kill-buffer-hook)))))