Closing Circe IRC Buffers in Emacs Without Leaving the Room

It’s a hack but it works:

To stay in a room (or rather: let the bouncer stay there) and still close the buffer locally, it helps to change the major mode of the circe buffer: M-x fundamental-mode RET. If you change the buffer’s mode to any text mode, the circe-mode specific teardown hooks won’t be triggered and you can close the buffer without leaving the room.

You don’t know what an IRC bouncer or circe is? Here’s some context.

circe is an Emacs package to connect to IRC servers. Unlike the built-in erc package, circe supports logging into bouncers with SASL authentication. That’s quite useful for some bouncers that require this.

A job of an IRC bouncer is to stay in an IRC room on your behalf and e.g. record messages that were sent while you were actually logged-out. When you set up a bouncer to stay in a room for you, if backlog replay works, that’s basically re-creating the experience you know from Slack and Discord.

So unless you want to always be online in chat, you will want to close the Emacs buffers that correspond to IRC rooms. After all, the bouncer will stay there for you. The idea is similar to closing Slack/Discord to focus on something else to return later and catch up.

By default, circe will not allow closing an IRC room’s buffer without leaving it. (Without a bouncer, that’s the default: you close the IRC client and leave all rooms.)