What is IRC and ERC?
In a basic sense, IRC is a protocol that allows two or more people to communicate through text over the internet. Unlike newer chat platforms, IRC solely relies on being able to communicate over plain text. This approach, in turn, allows this protocol to be usable even in situations where bandwidth is severely limited. One of the easiest IRC clients that you can use with Emacs is ERC. It’s an Elisp IRC client that supports features which allow you to modify it to suit your needs. For example, ERC can implement an “Autolog” feature where it saves all chat logs in files for a specific interval. Further, ERC also comes by default in a standard Emacs installation. This means that you do not need to install external packages or third-party repositories to start.
Getting Started with ERC
1. Joining an IRC Channel in Emacs
From there, ERC will use those details to create a new buffer and connect to your chat server. Once done, it will print the server’s welcome message as well as a small prompt where you can type text and commands.
2. Sending Your First IRC Message
Once inside, you can now start sending messages to the channel by typing after the ERC> prompt and pressing Enter. In this example, we’ve typed “Hello world!” in the prompt to send a message to the “#hello-world-test” channel. Aside from sending messages, you can also run a number of additional commands while in the ERC buffer.
3. Leaving an IRC Channel and Server in Emacs
Configuring ERC
Aside from sending chat texts, you can also modify ERC’s default behavior to suit your needs. For example, ERC allows you to not only add optional features but also create new ones through custom functions.
1. Enabling Optional Features Through Modules
One of the most powerful features of ERC is its ability to load and unload parts of the client through its modules system. This allows you to create a custom ERC instance that only does what you want it to do.
2. Adding a Third-Party ERC Module to Emacs
It is also possible to enable non-standard modules for ERC. This allows you to introduce new custom features without the need to tinker with ERC’s internals.
3. Defining New ERC Functions
Lastly, you can also add new features to ERC by writing Lisp functions directly to your init.el file. Unlike loading a custom module, this allows you to quickly introduce small tweaks to your ERC session. Image credits: Unsplash All screenshots by Ramces Red (define-key erc-mode-map “\C-m” ’newline) (define-key erc-mode-map “\C-c\C-c” ’erc-send-current-line) One important thing to note, however, is that you need to be wary of the current active keybindings for ERC. To do that, you can press Ctrl + H, then B while in an ERC buffer. Doing that will then tell Emacs to look at all the ERC-specific keybindings currently active for that buffer.