This manual is for ERC 5.5.0.29.1 as distributed with Emacs 29.4.
Copyright © 2005–2024 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License”.
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.”
All Emacs Lisp code contained in this document may be used, distributed, and modified without restriction.
ERC is a powerful, modular, and extensible IRC client for Emacs. It has been included in Emacs since 2006 (see History) and is also available on GNU ELPA.
IRC is short for Internet Relay Chat. When using IRC, you can communicate with other users on the same IRC network. There are many different networks—if you search for “IRC networks” in your favorite search engine, you will find up-to-date lists of IRC networks catering to various interests and topics.
To use IRC, you need an IRC client such as ERC. Using the client, you connect to an IRC server. Once you’ve done that, you will have access to all available channels on that server’s network. A channel is basically a chat room, and what you type in a channel will be shown to all other users in that channel. You can be in several channels at the same time—ERC will show each channel in its own buffer.
IRC channel names always begin with a ‘#’ character. For example, the Emacs channel on Libera.Chat is ‘#emacs’, and the ERC channel is ‘#erc’. Do not confuse them with the hashtags used on many social media platforms.
You can also send private messages to other IRC users on the same network, even if they are not in the same channels as you.
ERC comes with the following capabilities enabled by default.
The command M-x erc will start ERC and prompt for the server to connect to. If you’re unsure of which server or network to connect to, we suggest starting with “irc.libera.chat”. There you will find the ‘#emacs’ channels where you can chat with other Emacs users, and if you’re having trouble with ERC, you can join the ‘#erc’ channel and ask for help there.
If you want to place ERC settings in their own file, you can place them in ~/.emacs.d/.ercrc.el, creating it if necessary.
If you would rather use the Customize interface to change how ERC works, do M-x customize-group RET erc RET. In particular, ERC comes with lots of modules that may be enabled or disabled; to select which ones you want, do M-x customize-variable RET erc-modules RET.
This is an example ERC session which shows how to connect to the ‘#emacs’ channel on Libera.Chat. Another IRC channel on Libera.Chat that may be of interest is ‘#erc’, which is a channel where ERC users and developers hang out. These channels used to live on the Freenode IRC network until June 2021, when they—along with the official IRC channels of the GNU Project, the Free Software Foundation, and many other free software communities—relocated to the Libera.Chat network in the aftermath of changes in governance and policies of Freenode in May and June 2021. GNU and FSF’s announcements about this are at https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00005.html, https://lists.gnu.org/archive/html/info-gnu/2021-06/msg00007.html, and https://lists.gnu.org/archive/html/info-gnu-emacs/2021-06/msg00000.html.
Run M-x erc. Use “irc.libera.chat” as the IRC server, “6667” as the port, and choose a nickname.
Switch to the “irc.libera.chat:6667” buffer, if you’re not already there. You will see first some messages about checking for ident, and then a bunch of other messages that describe the current IRC server.
In that buffer, type “/join SPC #emacs” and hit RET. Depending on how you’ve set up ERC, either a new buffer for “#emacs” will be displayed, or a new buffer called “#emacs” will be created in the background. If the latter, switch to the “#emacs” buffer. You will see the channel topic and a list of the people who are currently on the channel.
If you would like to be able to talk with people privately on the Libera.Chat network, you will have to “register” your nickname. To do so, switch to the “irc.libera.chat:6667” buffer and type “/msg NickServ register <password>”, replacing “<password>” with your desired password. It should tell you that the operation was successful.
If you switch back to the “#emacs” buffer, you can type a message, and everyone on the channel will see it.
If you want to talk with someone in private (this should usually not be done for technical help, only for personal questions), type “/query <nick>”, replacing “<nick>” with the nickname of the person you would like to talk to. Depending on how ERC is set up, you will either see a new buffer with the name of the person, or such a buffer will be created in the background and you will have to switch to it. Begin typing messages, and you will be able to have a conversation.
Note that if the other person is not registered, you will not be able to talk with them.
ERC has some features that distinguish it from some IRC clients.
Every channel is put in a separate buffer. Several IRC servers may be connected to at the same time.
Private conversations are treated as channels, and are put into separate buffers in Emacs. We call these “query buffers”.
Some occurrences of words can be highlighted, which makes it easier to track different kinds of conversations.
ERC can notify you that certain users are online.
Channels can be hidden and conversation continue in the background. You are notified when something is said in such a channel that is not currently visible. This makes it easy to get Real Work done while still maintaining an IRC presence.
ERC can complete words upon hitting TAB, which eases the writing of nicknames in messages.
Past actions are kept in history rings for future use. To navigate a history ring, hit M-p to go backwards and M-n to go forwards.
Different channels and servers may have different language encodings.
multiple languages. Please contact the Emacs developers if you are interested in helping with the translation effort.
Users can load scripts (e.g., auto greeting scripts) when ERC starts up.
It is also possible to make custom IRC commands, if you know a little
Emacs Lisp. Just make an Emacs Lisp function and call it
erc-cmd-NEWCOMMAND
, where NEWCOMMAND
is the name of the
new command in capital letters.
If the connection goes away at some point, ERC will try to reconnect
automatically. If it fails to reconnect, and you want to try to
manually reestablish the connection at some later point, switch to an
ERC buffer and run the /RECONNECT
command.
This is a summary of keystrokes available in every ERC buffer.
erc-bol
)Go to beginning of line or end of prompt.
erc-send-current-line
)Send the current line
completion-at-point
or erc-button-next
)If at prompt, complete the current word. Otherwise, move to the next link or button.
ispell-complete-word
)Complete the given word, using ispell.
erc-bol
)Go to beginning of line or end of prompt.
erc-switch-to-buffer
)Use read-buffer
to prompt for a ERC buffer to switch to.
erc-toggle-interpret-controls
)Toggle interpretation of control sequences in messages.
erc-input-action
)Interactively input a user action and send it to IRC.
erc-toggle-ctcp-autoresponse
)Toggle automatic CTCP replies (like VERSION and PING).
erc-toggle-flood-control
)Toggle use of flood control on sent messages.
erc-invite-only-mode
)Turn on the invite only mode (+i) for the current channel.
erc-join-channel
)Join channel. If point is at the beginning of a channel name, use that as default.
erc-go-to-log-matches-buffer
)Interactively open an erc-log-matches buffer
erc-save-buffer-in-logs
)Append buffer contents to the log file, if logging is enabled.
erc-channel-names
)Run "/names #channel" in the current channel.
erc-get-channel-mode-from-keypress
)Read a key sequence and call the corresponding channel mode function. After doing C-c C-o, type in a channel mode letter.
C-g means quit.
RET lets you type more than one mode at a time.
If l is pressed, erc-set-channel-limit
gets called.
If k is pressed, erc-set-channel-key
gets called.
Anything else will be sent to erc-toggle-channel-mode
.
erc-part-from-channel
)Part from the current channel and prompt for a reason.
erc-quit-server
)Disconnect from current server after prompting for reason.
erc-remove-text-properties-region
)Clears the region (start,end) in object from all colors, etc.
erc-set-topic
)Prompt for a topic for the current channel.
erc-kill-input
)Kill current input line using erc-bol
followed by kill-line
.
One way to add functionality to ERC is to customize which of its many modules are loaded.
There is a spiffy customize interface, which may be reached by typing
M-x customize-option RET erc-modules RET.
When removing a module outside of the Custom ecosystem, you may wish
to ensure it’s disabled by invoking its associated minor-mode toggle
with a nonpositive prefix argument, for example, C-u - M-x
erc-spelling-mode RET. Additionally, if you plan on loading
third-party modules that perform atypical setup on activation, you may
need to arrange for calling erc-update-modules
in your init
file. Examples of such setup might include registering an
erc-before-connect
hook, advising erc-open
, and
modifying erc-modules
itself.
The following is a list of available modules.
autoaway
¶Set away status automatically
autojoin
¶Join channels automatically
bbdb
¶Integrate with the Big Brother Database
button
¶Buttonize URLs, nicknames, and other text
capab-identify
¶Mark unidentified users on freenode and other servers supporting CAPAB.
completion (aka pcomplete)
¶Complete nicknames and commands (programmable)
fill
¶Wrap long lines
identd
¶Launch an identd server on port 8113
irccontrols
¶Highlight or remove IRC control characters
log
¶Save buffers in logs
match
¶Highlight pals, fools, and other keywords
menu
¶Display a menu in ERC buffers
netsplit
¶Detect netsplits
noncommands
¶Don’t display non-IRC commands after evaluation
notify
¶Notify when the online status of certain users changes
notifications
¶Send you a notification when you get a private message, or your nickname is mentioned
page
¶Process CTCP PAGE requests from IRC
readonly
¶Make displayed lines read-only
replace
¶Replace text in messages
ring
¶Enable an input history
sasl
¶Enable SASL authentication
scrolltobottom
¶Scroll to the bottom of the buffer
services
¶Identify to Nickserv (IRC Services) automatically
smiley
¶Convert smileys to pretty icons
sound
¶Play sounds when you receive CTCP SOUND requests
spelling
¶Check spelling of messages
stamp
¶Add timestamps to messages
track
¶Track channel activity in the mode-line
truncate
¶Truncate buffers to a certain size
unmorse
¶Translate morse code in messages
Note that some modules are essential to core IRC operations and thus
not listed above. You can nevertheless still remove these, but doing
so demands special precautions to avoid degrading the user experience.
At present, the only such module is networks
, whose library ERC
always loads anyway.
All modules operate as minor modes under the hood, and some newer ones may be defined as buffer-local. These so-called “local modules” are a work in progress and their behavior and interface are subject to change. As of ERC 5.5, the only practical differences are as follows:
erc-sasl-mode
, retain their values
across IRC sessions and override erc-module
membership when
influencing module activation.
erc-modules
via Customize not only
disables its mode but also kills its control variable in all ERC
buffers.
erc-sasl-mode
and the complementary
erc-sasl-enable
/erc-sasl-disable
pairing, behave
differently than their global counterparts.
In target buffers, a local module’s activation state survives
“reassociation” by default, but modules themselves always have the
final say. For example, a module may reset all instances of itself in
its network context upon reconnecting. Moreover, the value of a mode
variable may be meaningless in buffers that its module has no interest
in. For example, the value of erc-sasl-mode
doesn’t matter in
target buffers and may even remain non-nil
after SASL has been
disabled for the current connection (and vice versa).
When it comes to server buffers, a module’s activation state only
persists for sessions revived via the automatic reconnection mechanism
or a manual ‘/reconnect’ issued at the prompt. In other words,
this doesn’t apply to sessions revived by an entry-point command, such
as erc-tls
, because such commands always ensure a clean slate
by looking only to erc-modules
. Although a session revived in
this manner may indeed harvest other information from a previous
server buffer, it simply doesn’t care which modules might have been
active during that connection.
Lastly, a local mode’s toggle command, like erc-sasl-mode
, only
affects the current buffer, but its “non-mode” cousins, like
erc-sasl-enable
and erc-sasl-disable
, operate on all
buffers belonging to their connection (when called interactively).
And unlike global toggles, none of these ever mutates
erc-modules
.
The easiest way to connect to an IRC server is to call M-x erc. If you want to assign this function to a keystroke, the following will help you figure out its parameters.
Select connection parameters and run ERC. Non-interactively, it takes the following keyword arguments.
For example, calling the command like so
(erc :server "irc.libera.chat" :full-name "J. Random Hacker")
sets server and full-name directly while leaving the rest
up to functions like erc-compute-port
. Note that some
arguments can’t be specified interactively. id, in particular,
is rarely needed (see Network Identifier).
To connect securely over an encrypted TLS connection, use M-x erc-tls.
Select connection parameters and run ERC over TLS. Non-interactively, it takes the following keyword arguments.
That is, if called in the following manner
(erc-tls :server "irc.libera.chat" :full-name "J. Random Hacker")
the command will set server and full-name accordingly,
while helpers, like erc-compute-nick
, will determine other
parameters, and some, like client-certificate
, will just be
nil
.
To use a certificate with erc-tls
, specify the optional
client-certificate keyword argument, whose value should be as
described in the documentation of open-network-stream
: if
non-nil
, it should either be a list where the first element is
the file name of the private key corresponding to a client certificate
and the second element is the file name of the client certificate
itself to use when connecting over TLS, or t
, which means that
auth-source
will be queried for the private key and the
certificate. Authenticating using a TLS client certificate is also
referred to as “CertFP” (Certificate Fingerprint) authentication by
various IRC networks.
Examples of use:
(erc-tls :server "irc.libera.chat" :port 6697 :client-certificate '("/home/bandali/my-cert.key" "/home/bandali/my-cert.crt"))
(erc-tls :server "irc.libera.chat" :port 6697 :client-certificate `(,(expand-file-name "~/cert-libera.key") ,(expand-file-name "~/cert-libera.crt")))
(erc-tls :server "irc.libera.chat" :port 6697 :client-certificate t)
In the case of :client-certificate t
, you will need to add a
line like the following to your authinfo file
(e.g. ~/.authinfo.gpg):
machine irc.libera.chat key /home/bandali/my-cert.key cert /home/bandali/my-cert.crt
See Help for users in Emacs auth-source Library, for more on the
.authinfo/.netrc backend of auth-source
.
For other uses of auth-source throughout ERC, see ERC’s auth-source integration.
Return an IRC server name.
This tries a number of increasingly more default methods until a non-nil
value is found.
erc-server
option
erc-default-server
variable
IRC server to use if one is not provided.
Return a port for an IRC server.
This tries a number of increasingly more default methods until a non-nil
value is found.
erc-port
option
erc-default-port
variable
IRC port to use if not specified.
This can be either a string or a number.
Return user’s IRC nick.
This tries a number of increasingly more default methods until a
non-nil
value is found.
erc-nick
option
user-login-name
function
Nickname to use if one is not provided.
This can be either a string, or a list of strings. In the latter case, if the first nick in the list is already in use, other nicks are tried in the list order.
A function to format a nickname for message display
You can set this to erc-format-@nick
to display user mode prefix
(setq erc-format-nick-function 'erc-format-@nick)
The string to append to the nick if it is already in use.
If the nickname you chose isn’t available, and this option is non-nil
,
ERC should automatically attempt to connect with another nickname.
You can manually set another nickname with the /NICK command.
Determine a suitable value to send as the first argument of the opening ‘USER’ IRC command by consulting the following sources:
erc-email-userid
, assuming erc-anonymous-login
is non-nil
user-login-name
A permanent username value to send for all connections. It should be a string abiding by the rules of the network.
This parameter was traditionally meant to specify a server password to be sent along with the IRC ‘PASS’ command. However, such passwords aren’t widely used. Instead, networks typically expect them, when present, to convey other authentication information. In the case of account-services (a.k.a., “NickServ”) credentials, this typically involves a special syntax, such as ‘myuser:mypass’. IRC bouncers often do something similar but include a pre-configured network-ID component, for example, ‘bncuser/mynet:bncpass’.
In general, if you have not been asked by your network or bouncer to specify a repurposed server password, you should instead consider setting up ‘services’ or, preferably, ‘sasl’, both ERC modules (see Modules). In addition to performing network-account authentication, these obviate the need for this parameter completely, although both can optionally borrow it for their own purposes. (See SASL in ERC.)
If non-nil
(the default), M-x erc and M-x erc-tls
prompt for a server password. This only affects interactive
invocations of erc
and erc-tls
.
If you prefer, you can set this option to nil
and use the
auth-source facility to retrieve a server password, although hitting
RET at the prompt may achieve the same effect.
See ERC’s auth-source integration, for more.
Return user’s full name.
This tries a number of increasingly more default methods until a
non-nil
value is found.
erc-user-full-name
option
user-full-name
function
User full name.
This can be either a string or a function to call.
ERC uses an abstract designation, called network context
identifier, for referring to a connection internally. While normally
derived from a combination of logical and physical connection
parameters, an ID can also be explicitly provided via an entry-point
command (like erc-tls
). Use this in rare situations where ERC
would otherwise have trouble discerning between connections.
One such situation might arise when using multiple connections to the same network with the same nick but different (nonstandard) ‘device’ identifiers, which some bouncers may support. Another might be when mimicking the experience offered by popular standalone clients, which normally offer “named” persistent configurations with server buffers reflecting those names. Yet another use case might involve third-party code needing to identify a connection unequivocally, but in a human-friendly way suitable for UI components.
When providing an ID as an entry-point argument, strings and symbols make the most sense, but any reasonably printable object is acceptable.
Regardless of the mechanism or the network, you’ll likely have to be
registered before first use. Please refer to the network’s own
instructions for details. If you’re new to IRC and using a bouncer,
know that you probably won’t be needing SASL for the client-to-bouncer
connection. To get started, just add sasl
to
erc-modules
like any other module. But before that, please
explore all custom options pertaining to your chosen mechanism.
The name of an SASL subprotocol type as a lowercase symbol. The value can be one of the following:
plain
and scram
(“password-based”)Here, “password” refers to your account password, which is usually
your ‘NickServ’ password. To make this work, customize
erc-sasl-user
and erc-sasl-password
or specify the
:user
and :password
keyword arguments when invoking
erc-tls
. Note that :user
cannot be given interactively.
external
(via Client TLS Certificate)This works in conjunction with the :client-certificate
keyword
offered by erc-tls
. Just ensure you’ve registered your
fingerprint with the network beforehand. The fingerprint is usually a
SHA1 or SHA256 digest in either "normalized" or "openssl" forms. The
first is lowercase without delims (‘deadbeef’) and the second
uppercase with colon seps (‘DE:AD:BE:EF’). These days, there’s
usually a ‘CERT ADD’ command offered by NickServ that can
register you automatically if you issue it while connected with a
client cert. See client-certificate.
Additional considerations:
ecdsa-nist256p-challenge
This mechanism is quite complicated and currently requires the
external ‘openssl’ executable, so please use something else if at
all possible. Ignoring that, specify your key file (e.g.,
‘~/pki/mykey.pem’) as the value of erc-sasl-password
, and
then configure your network settings. On servers running Atheme
services, you can add your public key with ‘NickServ’ like so:
ERC> /msg NickServ set property \ pubkey AgGZmlYTUjJlea/BVz7yrjJ6gysiAPaQxzeUzTH4hd5j
(You may be able to omit the ‘property’ subcommand.)
This should be your network account username, typically the same one
registered with nickname services. Specify this when your NickServ
login differs from the :user
you’re connecting with.
See username parameter.
As noted elsewhere, the entry-point :password
param was
originally intended for traditional “server passwords,” but these
aren’t really used any more (see password parameter). As such,
this option defaults to borrowing that parameter for its own uses,
thus allowing you to call erc-tls
with :password
set to
your NickServ password.
You can also set this to a nonemtpy string, and ERC will send that
when needed, no questions asked. Or, if you’d rather use auth-source,
set erc-sasl-auth-source-function
to a function, and ERC will
perform an auth-source query instead. In all cases, ERC will prompt
you for input as a last resort.
Lastly, if your mechanism is ecdsa-nist256p-challenge
, this
option should instead hold the file name of your key.
This is nearly identical to the other ERC ‘auth-source’ function
options (see auth-source functions) except that the default value
here is nil
, meaning you have to set it to something like
erc-auth-source-search
for queries to be performed. For
convenience, this module provides the following as a possible value:
Setting erc-sasl-auth-source-function
to this function tells
ERC to use erc-sasl-password
for the :host
field when
querying auth-source, even if its value is the default
:password
, in which case ERC knows to “resolve” it to
erc-session-password
and use that as long as it’s
non-nil
. Otherwise, ERC just defers to
erc-auth-source-search
to determine the :host
, along
with everything else.
As long as this option specifies a function, ERC will pass it the
“resolved” value of erc-sasl-user
for the auth-source
:user
param.
In the rarest of circumstances, a network may want you to specify a
specific role or assume an alternate identity. In most cases, this
happens because the server is buggy or misconfigured. If you suspect
such a thing, please contact your network operator. Otherwise, just
leave this set to nil
.
(erc-tls :server "irc.libera.chat" :port 6697 :nick "aph" :user "APHacker" :password "changeme")
Here, after adding sasl
to erc-modules
via the Customize
interface, you authenticate to Libera.Chat using the ‘PLAIN’
mechanism and your NickServ credentials, ‘APHacker’ and
‘changeme’.
(setopt erc-sasl-mechanism 'external) (erc-tls :server "irc.libera.chat" :port 6697 :nick "aph" :client-certificate '("/home/aph/my.key" "/home/aph/my.crt"))
You decide to switch things up and try out the ‘EXTERNAL’ mechanism. You follow your network’s instructions for telling NickServ about your client-certificate’s fingerprint, and you authenticate successfully.
# ~/.authinfo.gpg machine irc.libera.chat key /home/aph/my.key cert /home/aph/my.crt machine Example.Net login alyssa password sEcReT machine Example.Net login aph-bot password sesame
;; init.el (defun my-erc-up (network) (interactive "Snetwork: ") (pcase network ('libera (let ((erc-sasl-mechanism 'external)) (erc-tls :server "irc.libera.chat" :port 6697 :client-certificate t))) ('example (let ((erc-sasl-auth-source-function #'erc-sasl-auth-source-password-as-host)) (erc-tls :server "irc.example.net" :port 6697 :user "alyssa" :password "Example.Net")))))
You’ve started storing your credentials with auth-source and have
decided to try SASL on another network as well. But there’s a catch:
this network doesn’t support ‘EXTERNAL’. You use
let
-binding to get around this and successfully authenticate to
both networks.
First and foremost, please know that ERC’s SASL offering is currently limited by a lack of support for proper IRCv3 capability negotiation. In most cases, this shouldn’t affect your ability to authenticate.
If you’re struggling, remember that your SASL password is almost
always your NickServ password. When in doubt, try restoring all SASL
options to their defaults and calling erc-tls
with :user
set to your NickServ account name and :password
to your
NickServ password. If you’re still having trouble, please contact us
(see Getting Help and Reporting Bugs).
As you try out different settings, keep in mind that it’s best to
create a fresh session for every change, for example, by calling
erc-tls
from scratch. More experienced users may be able to
get away with cycling erc-sasl-mode
and issuing a
‘/reconnect’, but that’s generally not recommended. Whatever the
case, you’ll probably want to temporarily disable
erc-server-auto-reconnect
while experimenting.
Here is an example of configuration settings for ERC. This can go into
your Emacs configuration file. Everything after the (require
'erc)
command can optionally go into ~/.emacs.d/.ercrc.el.
;;; Sample ERC configuration ;; Load authentication info from an external source. Put sensitive ;; passwords and the like in here. (load "~/.emacs.d/.erc-auth") ;; This is an example of how to make a new command. Type "/uptime" to ;; use it. (defun erc-cmd-UPTIME (&rest ignore) "Display the uptime of the system, as well as some load-related stuff, to the current ERC buffer." (let ((uname-output (replace-regexp-in-string ", load average: " "] {Load average} [" ;; Collapse spaces, remove (replace-regexp-in-string " +" " " ;; Remove beginning and trailing whitespace (replace-regexp-in-string "^ +\\|[ \n]+$" "" (shell-command-to-string "uptime")))))) (erc-send-message (concat "{Uptime} [" uname-output "]")))) ;; This causes ERC to connect to the Libera.Chat network upon hitting ;; C-c e f. Replace MYNICK with your IRC nick. (global-set-key "\C-cef" (lambda () (interactive) (erc :server "irc.libera.chat" :port "6667" :nick "MYNICK"))) ;; This causes ERC to connect to the IRC server on your own machine (if ;; you have one) upon hitting C-c e b. Replace MYNICK with your IRC ;; nick. Often, people like to run bitlbee (https://bitlbee.org/) as an ;; AIM/Jabber/MSN to IRC gateway, so that they can use ERC to chat with ;; people on those networks. (global-set-key "\C-ceb" (lambda () (interactive) (erc :server "localhost" :port "6667" :nick "MYNICK"))) ;; Make C-c RET (or C-c C-RET) send messages instead of RET. This has ;; been commented out to avoid confusing new users. ;; (define-key erc-mode-map (kbd "RET") nil) ;; (define-key erc-mode-map (kbd "C-c RET") 'erc-send-current-line) ;; (define-key erc-mode-map (kbd "C-c C-RET") 'erc-send-current-line) ;;; Options ;; Join the #emacs and #erc channels whenever connecting to ;; Libera.Chat. (setq erc-autojoin-channels-alist '(("Libera.Chat" "#emacs" "#erc"))) ;; Interpret mIRC-style color commands in IRC chats (setq erc-interpret-mirc-color t) ;; The following are commented out by default, but users of other ;; non-Emacs IRC clients might find them useful. ;; Kill buffers for channels after /part ;; (setq erc-kill-buffer-on-part t) ;; Kill buffers for private queries after quitting the server ;; (setq erc-kill-queries-on-quit t) ;; Kill buffers for server messages after quitting the server ;; (setq erc-kill-server-buffer-on-quit t)
For anything to work, you’ll want to set url-irc-function
to
url-irc-erc
. As a rule of thumb, libraries relying directly on
url-retrieve
should be fine out the box from Emacs 29.1 onward.
On older versions of Emacs, you may need to (require 'erc)
beforehand. See Retrieving URLs in URL.
For other apps and libraries, such as those relying on the
higher-level browse-url
, you’ll oftentimes be asked to specify
a pattern, sometimes paired with a function that accepts a string URL
as a first argument. For example, with EWW, you may need to tack
something like "\\|\\`irc6?s?:"
onto the end of
eww-use-browse-url
. But with gnus-button-alist
, you’ll
need a function as well:
'("\\birc6?s?://[][a-z0-9.,@_:+%?&/#-]+" 0 t browse-url-irc 0)
Users on Emacs 28 and below may need to use browse-url
instead.
You can configure ERC to use the built-in auth-source library for
looking up passwords. See auth-source in Emacs auth-source
Library, for general info on setting up various backends, but keep in
mind that some of these may not be compatible. Those currently
supported are netrc, plstore, json, secrets, and pass. To get started
with the default backend, netrc, put a line like the following in your
~/.authinfo.gpg (or any file named in the option
auth-sources
):
machine irc.example.net login mynick password sEcReT
When retrieving passwords to accompany the IRC ‘PASS’ command
(see password parameter), ERC asks auth-source to match the
server parameter of erc-tls
against each entry’s
‘host’ field (machine irc.example.net
in the above
example). Unfortunately, specifying a network, like
‘Libera.Chat’, or a specific network server, like
‘platinum.libera.chat’, won’t normally work for looking up a
server password because that information isn’t available during
opening introductions. (Actually, ERC can find entries with
arbitrary ‘host’ values for any context, including server
passwords, but that requires customizing the more advanced options
below.)
If ERC can’t find a suitable server password, it will just skip the
IRC ‘PASS’ command altogether, something users may want when
using CertFP or engaging NickServ via ERC’s services
module.
If that appeals to you, consider customizing the option
erc-auth-source-server-function
to nil
to skip
server-password lookup for all servers. Note that some networks and
IRCds may accept account-services authentication via server password.
Also, some ERC modules may commandeer the erc-tls
password parameter for their own ends, which likely don’t
involve a server password.
You can use auth-source to authenticate to account services the
traditional way through a bot called ‘NickServ’. To do so, add
services
to erc-modules
and set the option
erc-use-auth-source-for-nickserv-password
to t
. After
that, expect the ‘user’ parameter in relevant auth-source queries
to be your current nickname.
Most of the time, a query’s precise contextual details (such as
whether a nick was granted or forcibly assigned) shouldn’t affect how
you define entries in your backend. However, if something isn’t quite
working, you may want to investigate the interplay between the option
erc-nickserv-identify-mode
and account services. In
particular, if you find yourself facing nicks suffixed with an
erc-nick-uniquifier
(the infamous ‘`’), check that the
network’s entry in erc-nickserv-alist
is up to date, and do let
us know if something’s off (see Getting Help and Reporting Bugs).
Of course, if you’ve had your fill of fiddling with this module,
consider switching to SASL for what’s likely a more consistent
auth-source experience. (See Authenticating via SASL.)
When preparing entries for your backend, it may help to get a feel for
how ERC and its modules conduct searches, especially when exploring a
new context, such as channel keys. (Hint: in such situations, try
temporarily setting the variable auth-source-debug
to t
and checking *Messages* periodically for insights into how
auth-source is operating.) Overall, though, ERC tries to be
consistent in performing queries across various authentication
contexts. Here’s what to expect with respect to the ‘host’
field, which, by default, most heavily influences the fate of a query:
erc-tls
)
The following netrc-style entries appear in order of precedence:
machine Libera/cellphone login MyNick password sEcReT machine Libera.Chat login MyNick password sEcReT machine zirconium.libera.chat login MyNick password sEcReT machine irc.libera.chat login MyNick password sEcReT
Remember that field labels vary per backend, so ‘machine’ (in
netrc’s case) maps to auth-source’s generalized notion of a host,
hence the ‘:host’ keyword parameter to auth-source-search
.
Also, be sure to mind the syntax of your chosen backend medium. For
example, always quote channel names in a netrc file.
Lastly, if this all seems overly nuanced or just plain doesn’t appeal
to you, please see options erc-auth-source-services-function
and friends, described just below.
These let you query auth-source your way. Most users can simply ignore the passed-in arguments and get by with something like the following:
(defun my-fancy-auth-source-func (&rest _) (let* ((host (read-string "host: " nil nil "default")) (pass (auth-source-pick-first-password :host host))) (if (and pass (string-search "libera" host)) (concat "MyNick:" pass) pass)))
ERC calls these functions with keyword arguments recognized by
auth-source-search
, namely, those deemed most relevant to the
current context, if any. For example, when identifying to services,
:user
contains your current nickname. Generalized parameter
names, like :user
and :host
, are always preferred over
backend specific ones, like :login
or :machine
. In
return, ERC expects a string if the search succeeds or nil
if
it fails.
The default value for all three options is the function
erc-auth-source-search
. It tries to merge relevant contextual
parameters with those provided or discovered from the logical
connection or the underlying transport.
For using auth-source along with SASL, see SASL auth-source function.
ERC also consults auth-source
to find “keys” that may be
required by certain channels you join. When modifying a traditional
auth-source
entry for this purpose, put the channel name in the
‘user’ field (for example, ‘login "#fsf"’, in netrc’s case).
The actual key goes in the ‘password’ (or ‘secret’) field.
This section is extremely incomplete. For now, the easiest way to check out all the available options for ERC is to do M-x customize-group RET erc RET.
If non, nil
, this is a list of IRC message types to hide, e.g.:
(setq erc-hide-list '("JOIN" "PART" "QUIT"))
If non, nil
, this is a list of IRC networks and message types
to hide, e.g.:
(setq erc-network-hide-list (("Libera.Chat" "JOIN" "PART" "QUIT") ("OFTC" "JOIN" "PART""))
If non, nil
, this is a list of IRC channels and message types
to hide, e.g.:
(setq erc-channel-hide-list (("#erc" "JOIN" "PART" "QUIT") ("#emacs" "NICK"))
Like erc-hide-list
, but only applies to messages sent by
lurkers. The function erc-lurker-p
determines whether a given
nickname is considered a lurker.
After you have read this guide, if you still have questions about ERC, or if you have bugs to report, there are several places you can go.
To upgrade, run M-x list-packages RET. In the
*Packages* (package-menu-mode
) buffer, click the
‘erc’ package link for the desired version. If unsure, or if the
version column is too narrow to tell, try the bottom-most candidate.
In the resulting help-mode
buffer, confirm the version and
click ‘Install’. Make sure to restart Emacs before reconnecting
to IRC, and don’t forget that you can roll back to the previous
version by running M-x package-delete RET.
See Packages in the Emacs manual for more information.
In the rare instance you need an emergency fix or have volunteered to
test an edge feature between ERC releases, you can try adding
‘("devel" . "https://elpa.gnu.org/devel/")’ to
package-archives
prior to performing the steps above. For
this, you’ll want to instead select a “snapshot” version from the
menu. Please be aware that when going this route, the latest changes
may not yet be available and you run the risk of incurring other bugs
and encountering unstable features.
ERC was originally written by Alexander L. Belikoff and Sergey Berezin. They stopped development around December 1999. Their last released version was ERC 2.0.
P.S.: If one of the original developers of ERC reads this, we’d like to receive additional information for this file and hear comments in general.
In June 2001, Mario Lang and Alex Schroeder took over development and created a ERC Project at https://sourceforge.net/projects/erc.
In reaction to a mail about the new ERC development effort, Sergey Berezin said, “First of all, I’m glad that my version of ERC is being used out there. The thing is, I do not have free time and enough incentive anymore to work on ERC, so I would be happy if you guys take over the project entirely.”
So we happily hacked away on ERC, and soon after (September 2001) released the next "stable" version, 2.1.
Most of the development of the new ERC happened on ‘#emacs’ on irc.openprojects.net. Over time, many people contributed code, ideas, bugfixes, and a lot of alpha/beta/gamma testing.
See the CREDITS file for a list of contributors.
ERC 3.0 was released.
ERC 4.0 was released.
ERC 5.0 was released. Michael Olson became the release manager and eventually the maintainer.
After some discussion between him and the Emacs developers, it was decided to include ERC in Emacs.
ERC 5.1 was released. It was subsequently included in Emacs 22.
ERC became an official GNU project, and development moved to https://sv.gnu.org/projects/erc. We switched to using GNU Arch as our revision control system. Our mailing list address changed as well.
We switched to using git for our version control system.
Since about 2009, ERC is no longer developed as a separate project, but is maintained as part of Emacs.
Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. https://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.
This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.
We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.
This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.
A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.
A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.
A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.
The “publisher” means any person or entity that distributes copies of the Document to the public.
A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.
You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.
You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”
You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.
A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See https://www.gnu.org/licenses/.
Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Document.
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A “Massive Multiauthor Collaboration” (or “MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization.
“Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.
An MMC is “eligible for relicensing” if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing.
To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with…Texts.” line with this:
with the Invariant Sections being list their titles, with the Front-Cover Texts being list, and with the Back-Cover Texts being list.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.