init-erc.org 8.6 KB

My ERC information

My username is joshuaBPMan.

learning irc

all of the irc commands

https://www.emacswiki.org/emacs/ErcCommands

all of the irc services

https://wiki.mibbit.com/index.php/IRC_services

cool website with irc info

http://www.ircbeginner.com/

cool commands

/nick NICK changes your nickname

/msg IRC_PERSON opens a private chat with someone.

/me waves to the world This lets you wave to the world. Or whatever you want to do. Just up and down, etc.

/shortcut IRC_COMMAND args This command lets you create a shortcut command. So "/from /me is from Indiana" lets you type "/from" and irc will tell the world where you're from.

glossary

http://www.ircbeginner.com/ircinfo/ircglossary.html

tutorials

znc

http://www.ircbeginner.com/ircinfo/tutorials.html

If you've configured erc to auto-reconnect to the irc network you may have some issues. Erc tends to disconnect from the irc servers. It just happens. When it auto-reconects, it may block your emacs session for a time while it reconnects everything. You would also lose some of the stuff that happened in the irc session. Also people would get lots of info about you losing the connection.

Enter ZNC! ZNC is an irc proxy. Basically ZNC is a daemon that connects to irc for you. It will never lose the connection, unlike emacs. Then you can connect erc to znc. Emacs will periodically lose the connection to znc, but when it does reconnect, znc will restore all of the irc chats.

http://172.16.113.76:1025/

https://wiki.archlinux.org/index.php/ZNC

http://wiki.znc.in/ZNC

http://wiki.znc.in/Pidgin#Connecting_to_ZNC

I've got znc set up to listen on port 1025. I think I'm supposed to give it my login details?

the config file is here: [var/lib/znc.znc/configs/znc.conf]...

To connect to this ZNC you need to connect to it as your IRC server using the port that you supplied. You have to supply your login info as the IRC server password like this: user/network:pass.

Try something like this in your IRC client... /server 1025 joshua:

To manage settings, users and networks, point your web browser to http://:1025/

My ERC config

use-package declaration

I can define some emacs testing of variables. This will hopefully help me spot errors. cool. (ert-deftest pp-test-quote () "Tests the rendering of `quote' symbols in `pp-to-string'." (should (equal (pp-to-string '(quote quote)) "'quote")) (should (equal (pp-to-string '((quote a) (quote b))) "('a 'b)\n")) (should (equal (pp-to-string '('a 'b)) "('a 'b)\n")))

Erc can be a bit of a pain to get it set up to remember your password. Store your password in a .authinfo.gpg file. (if you have to store it in a .authinfo file). It'll look like this:

machine irc.freenode.net password PASSWORD port 6667 machine irc.freenode.net password PASSWORD port 6697

Irc will remember your username, and it'll find your password. Also connect via erc-tls. It's encrypted.


  (use-package erc
    :init
    ;; Join the #emacs and #erc channels whenever connecting to Freenode.
    (setq erc-autojoin-channels-alist '(
                                        ;;("freenode.net" "#archlinux")
                                        ;;("ircs://irc.oftc.net:6697" "#awesome")
                                        ;;("freenode.net" "#deskthority")
                                        ;;("freenode.net" "#erc")
                                        ("libera.chat" "#emacs")
                                        ;;("libera.chat" "#fsf")
                                        ;;("libera.chat" "#gnupg")
                                        ("libera.chat" "#gnus")
                                        ("libera.chat" "#guix")
                                        ("libera.chat" "#guile")
                                        ("libera.chat" "#hurd")
                                        ("libera.chat" "#org-mode")
                                        ;;("libera.chat" "#openhatch")
                                        ("libera.chat" "#nginx")
                                        ;;regular meeting take place every thursday at 19:00 UTC
                                        ;; get questions answered about building your own keyboard
                                        ;; https://www.parabola.nu/
                                        ;;("libera.chat" "#parabola")
                                        ;;purdue users group
                                        ;;("libera.chat" "#purduelug")
                                        ("libera.chat" "#wordpress")
                                        ;;("libera.chat" "#znc")
                                        ;;("libera.chat" "#debian-hurd")
                                        ("irc.w3.org" "#social")  ; Chris web's social incubator group for activity pub
                                        )

          ;; Rename server buffers to reflect the current network name instead
          ;; of SERVER:PORT. (e.g. "freenode" instead of "irc.freenode.net:6667"). This
          ;; is useful when using a bouncer like ZNC where you have multiple
          ;; connections to the same server.
          erc-rename-buffers t
          ;; set the default nick
          erc-nick "joshuaBPMan"
          ;;erc-prompt-for-password t
          erc-hide-list '("JOIN" "PART" "QUIT")
          ;; don't let erc switch the active buffer when it connects to a new channel when erc is starting up
          ;; this gets annoying because when I'm starting up emacs, it'll switch to "#arch", then "#hurd", then "#org-mode".
          ;; it's very weird.  But after erc has loaded and those initial buffers come up, I want erc to jump to a new channel
          ;; when I try to join it
          erc-join-buffer 'bury
          erc-port 6697

          ;; Interpret mIRC-style color commands in IRC chats
          erc-interpret-mirc-color t)

    ;; don't prompt me for my password erc should know it
    ;; guixSD cannot read my gpg keys.  This way I can still use erc on GuixSD
    (if (equal system-name "parabola")
        (setq erc-prompt-for-password nil)
      (setq erc-prompt-for-password t))

    :config

    (setq erc-join-buffer 'bury)
    (setq erc-track-exclude
          '("#purduelug"
            "#znc"
            "#deskauthority"
            "#erc"
            "fsf"
            "#wordpress"
            "#guile"
            "#gnupg"
            "parabola"
            "#nginx"
            "#awesome"))

    :diminish erc-mode
    :defer t)

  (defun my/connect-to-erc ()
    (interactive)
    (erc-tls :server "irc.libera.chat" :port "6697"
             :nick "jab")
    ;;(erc-tls :server "irc.w3.org" :port 6697 :nick "joshuaBPMan" :password "babbages")
    ;;(erc :server "irc.w3.org" :port 6667 :nick "joshuaBPMan" :password "babbages")
    )
    ;; when I have an internet connection, connect to erc.
  (when my-onlinep
    (add-hook 'after-init-hook 'my/connect-to-erc))

(auth-source-search :max 5 :host "irc.w3.org" :require '(:user :secret) )

COMMENT making new commands

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 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 (http://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")))

provide init-erc


(provide 'init-erc)