I look for command to close all ERC related buffers, I couldn't find anything build-in. Does anyone implemented function like that or know how this function should look like?

2 Answers 2


I would use:

  • M-x ibuffer (this is my C-xC-b binding)
  • Either of these to mark the buffers of interest:
    • *M erc-mode RET
    • %m erc RET
  • D to kill marked buffers
  • Do you know any way to make it single command?
    – Navidot
    Commented Mar 30, 2021 at 22:08

Yes, I hacked something together some time ago.

The behavior of +erc-quit is to kill all buffers and child processes of (erc-buffer-list) without prompting for confirmation - it does this setting kill-buffer-query-functions to nil. If that doesn't fit you, just remove the list from the let binding.

(defun +erc-quit ()
    "Kill ERC buffers and terminate any child processes."
    (let ((kill-buffer-query-functions nil)
          (erc-buffers (erc-buffer-list)))
      (if (not erc-buffers)
          (message "There are no ERC buffers to kill."))
        (dolist (buffer erc-buffers)
          (kill-buffer buffer))
        (message "Killed all ERC buffers."))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.