IRC and Bitlbee Interface
Table of Contents
A literate programming configuration file for IRC communiction.
Introduction
My IRC needs are basic, but I'm not sure which I want to use.
ERC
(use-package erc-hl-nicks :after erc) (use-package erc-image :after erc) (use-package erc :commands erc :config (setq erc-nick "howard-abrams" erc-user-full-name "Howard Abrams" erc-prompt ">>" erc-prompt-for-nickserv-password nil erc-auto-query 'bury erc-join-buffer 'bury erc-interpret-mirc-color t erc-rename-buffers t erc-hide-list '("JOIN" "PART" "QUIT") erc-track-enable-keybindings nil erc-track-visibility nil ; Only use the selected frame for visibility erc-fill-column 120 erc-fill-function 'erc-fill-static erc-fill-static-center 20 erc-timestamp-only-if-changed-flag nil ;; erc-timestamp-format "%H:%M" erc-autojoin-channels-alist '(("howardabrams.com" "#emacs" "#org-mode")) erc-quit-reason (lambda (s) (or s "Fading out...")) erc-modules '(autoaway autojoin button completion fill irccontrols keep-place list match menu move-to-prompt netsplit networks noncommands readonly ring stamp track hl-nicks))) (defun ha-erc-connect-irc () "Connect to my favorite IRC server with ERC." (interactive) (let* ((auth-results (auth-source-search :host "irc.libera.chat" :port 6667 :max 1)) (auth-first (first auth-results)) (username (plist-get auth-first :user)) (password (funcall (plist-get auth-first :secret)))) (erc :server "irc.libera.chat" :port 6667) (sit-for 2) (erc-cmd-QUOTE (format "PASS %s:%s" username password))))
I like to make sure the text formats to the size of the window:
(defun ha-erc-resize-text () "Resize the ERC text to fill the current window." (interactive) (setq erc-fill-column (1- (window-width))))
ZNC Server
I'm using my own ZNC server, and I need to log in with a password stored in my GPG auth storage:
(defun ha-erc-reconnect-password () "Send the reconnection password string." (interactive) (let* ((auth-results (auth-source-search :host "howardabrams.com" :port 7777 :max 1)) (auth-first (first auth-results)) (username (plist-get auth-first :user)) (password (funcall (plist-get auth-first :secret)))) (erc-cmd-QUOTE (format "PASS %s:%s" username password))))
Key Bindings
Quick way to start and jump to my IRC world.
(defun ha-irc-persp-start () "Create an IRC workspace and start my IRC client." (interactive) (persp-switch "irc") (ha-erc-connect-irc)) (defun ha-irc-persp-switch () "Switch to the IRC workspace and load the next buffer." (interactive) (persp-switch "irc") (call-interactively 'erc-track-switch-buffer))
And some global keys to display them:
(ha-leader "a i" '("irc switch" . ha-irc-persp-switch) "a I" '("irc start" . ha-irc-persp-start))
And a quick shortcuts to call it:
(ha-local-leader :keymaps '(erc-mode-map) "o" '("next channel" . erc-track-switch-buffer) "w" '("resize text" . ha-erc-resize-text) "r" '("reconnect" . ha-erc-connect-irc) "p" '("send password" . ha-erc-reconnect-password))
Display Configuration
Using the Doom Modeline to add notifications:
(setq doom-modeline-irc t doom-modeline-irc-stylize 'identity)