Next: , Up: Advanced Usage   [Contents][Index]

5.1 Connecting to an IRC Server

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.

Function: erc

Select connection parameters and run ERC. Non-interactively, it takes the following keyword arguments.

That is, if called with the following arguments, server and full-name will be set to those values, whereas erc-compute-port, erc-compute-nick and erc-compute-full-name will be invoked for the values of the other parameters.

(erc :server "irc.freenode.net" :full-name "Harry S Truman")

Server

Function: erc-compute-server &optional server

Return an IRC server name.

This tries a number of increasingly more default methods until a non-nil value is found.

User Option: erc-server

IRC server to use if one is not provided.

Port

Function: erc-compute-port &optional port

Return a port for an IRC server.

This tries a number of increasingly more default methods until a non-nil value is found.

User Option: erc-port

IRC port to use if not specified.

This can be either a string or a number.

Nick

Function: erc-compute-nick &optional nick

Return user’s IRC nick.

This tries a number of increasingly more default methods until a non-nil value is found.

User Option: erc-nick

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.

User Option: erc-format-nick-function

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)
User Option: erc-nick-uniquifier

The string to append to the nick if it is already in use.

User Option: erc-try-new-nick-p

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.

Password

User Option: erc-prompt-for-password

If non-nil (the default), M-x erc prompts for a password.

If you prefer, you can set this option to nil and use the auth-source mechanism to store your password. For instance, if you use ~/.authinfo as your auth-source backend, then put something like the following in that file:

machine irc.example.net login "#fsf" password sEcReT

ERC also consults auth-source to find any channel keys required for the channels that you wish to autojoin, as specified by the variable erc-autojoin-channels-alist.

For more details, see auth-source in Emacs auth-source Library.

Full name

Function: erc-compute-full-name &optional full-name

Return user’s full name.

This tries a number of increasingly more default methods until a non-nil value is found.

User Option: erc-user-full-name

User full name.

This can be either a string or a function to call.

Next: , Up: Advanced Usage   [Contents][Index]