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?
For completeness I propose an answer allowing to store both your account ID and password.
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).
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.