Question

When entering IRC with M-erc, Emacs remembers the last used server name and port. You can accept, hitting enter, or change those parameters.

As for the user name, it defaults to system user name and not to the last used one. How can I have Emacs to suggest the last user name or a predefined one?

Was it helpful?

Solution

For completeness I propose an answer allowing to store both your account ID and password.

Solution 1: Store account in the Emacs init file

Append/add to your Emacs init file:

(setq erc-nick "my-nice-id")  
(setq erc-password "my-nice-pw")  

Note: You will get an y/n query to accept default password (i.e. my-nice-pw).

Solution 2: Store account in an external storage file

To avoid sharing your sensitive data when/if you share your Emacs init file or to store your data in a more secure directory, you can store your account data in an external file. Append/add to your Emacs init file:

(let ((acc (read-lines "~/.my-erc-account")))
  (setq erc-nick (car acc))  
  (setq erc-password (nth 1 acc)))

where ".my-erc-account" contains:

"my-nice-id"
"my-nice-pw"

Place and name this file as it is more convenient for you and adjust the read-lines argument accordingly.

OTHER TIPS

You might want to look at:

M-x customize-group RET erc RET

(n.b. ERC has a lot of customisation options, so you'll probably find some interesting things in there...)

I created a very simple Elisp function to simply the process of ERC login: http://wenshanren.org/?p=314

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top