diff --git a/modules/doc/README.md b/modules/doc/README.md index 6e6da72..d1025e5 100644 --- a/modules/doc/README.md +++ b/modules/doc/README.md @@ -11,7 +11,7 @@ following links. - Common-Lisp - CSS - Emacs-Lisp -- ERC +- [ERC](prelude-erc.md) - Erlang - Elixir - Haskell diff --git a/modules/doc/prelude-erc.md b/modules/doc/prelude-erc.md new file mode 100644 index 0000000..539c725 --- /dev/null +++ b/modules/doc/prelude-erc.md @@ -0,0 +1,31 @@ +# Prelude ERC Quickstart + +## Customizing Server list + +If you want to join a list of servers on `M-x start-irc`, other than the default list, please redefine the variable `my-fav-irc` as follows in your personal config + +``` emacs-lisp +(setq my-fav-irc '( "irc.freenode.net" + "irc.oftc.net" + "irc.mozilla.org" + "irc.gnome.org")) +``` + +## Customizing Last Quit Message + +If you want to customize your IRC Last Quit Message from *Asta la vista* to something more funkier, please redefine `bye-irc-message` as follows + +``` emacs-lisp +(setq bye-erc-message "adios") +``` + +## Reading NickServ passwords from auth-source plugin + +If you want to automatically authenticate while logging into IRC servers set the `erc-prompt-for-password` to nil as follows + +``` emacs-lisp +(setq erc-prompt-for-password nil) +``` + +Now you can set password in plaintext in .authinfo file in the netRC format or you it encrypted in .authinfo.gpg file after setting up gpg in emacs + diff --git a/modules/prelude-erc.el b/modules/prelude-erc.el index 7a80771..fb5f2c9 100644 --- a/modules/prelude-erc.el +++ b/modules/prelude-erc.el @@ -112,11 +112,24 @@ that can occur between two notifications. The default is ;; utf-8 always and forever (setq erc-server-coding-system '(utf-8 . utf-8)) + +(defvar my-fav-irc '( "irc.freenode.net" ) + "Stores the list of IRC servers that you want to connect to with start-irc.") + +(defvar bye-irc-message "Asta la vista" + "Message string to be sent while quitting IRC.") + +(defun connect-to-erc (server) + "Connects securely to IRC SERVER over TLS at port 6697." + (erc-tls :server server + :port 6697 + :nick erc-nick )) + (defun start-irc () - "Connect to IRC." + "Connect to IRC?" (interactive) (when (y-or-n-p "Do you want to start IRC? ") - (erc :server "irc.freenode.net" :port 6667 :nick erc-nick))) + (mapcar 'connect-to-erc my-fav-irc))) (defun filter-server-buffers () (delq nil @@ -125,14 +138,12 @@ that can occur between two notifications. The default is (buffer-list)))) (defun stop-irc () - "Disconnects from all irc servers" + "Disconnects from all irc servers." (interactive) (dolist (buffer (filter-server-buffers)) (message "Server buffer: %s" (buffer-name buffer)) (with-current-buffer buffer - (erc-quit-server "Asta la vista")))) - -(setq erc-autojoin-channels-alist '(("freenode.net" "#prelude-emacs" "#projectile"))) + (erc-quit-server bye-irc-message)))) (provide 'prelude-erc)