about summary refs log tree commit diff
path: root/configs/shared/.emacs.d/wpc/irc.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2019-10-09T11·13+0100
committerWilliam Carroll <wpcarro@gmail.com>2019-12-24T15·21+0000
commit6b456c1b7a4f6899f063a6e65355af51901d9c7a (patch)
treecfc70d74818ae9fabdbbfb0cf16cce092e4c1a09 /configs/shared/.emacs.d/wpc/irc.el
parenta7c72adb2ebec1e497fc040eaf3551d564d61a5b (diff)
Massive configuration overhaul
Currently paying the price of months of non-diligent git usage.

Here's what has changed.

- Theming support in Gvcci and wpgtk
- Dropping support for i3
- Supporting EXWM
- Many Elisp modules
- Collapsed redundant directories in ./configs
Diffstat (limited to 'configs/shared/.emacs.d/wpc/irc.el')
-rw-r--r--configs/shared/.emacs.d/wpc/irc.el79
1 files changed, 79 insertions, 0 deletions
diff --git a/configs/shared/.emacs.d/wpc/irc.el b/configs/shared/.emacs.d/wpc/irc.el
new file mode 100644
index 000000000000..3dfaabdb397b
--- /dev/null
+++ b/configs/shared/.emacs.d/wpc/irc.el
@@ -0,0 +1,79 @@
+;;; irc.el --- Configuration for IRC chat -*- lexical-binding: t -*-
+;; Author: William Carroll <wpcarro@gmail.com>
+
+;;; Commentary:
+;; Need to decide which client I will use for IRC.
+
+;;; Code:
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Dependencies
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(require 'erc)
+(require 'cycle)
+(require 'string)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Configuration
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(setq erc-rename-buffers t)
+
+(defvar irc/channels-cycle
+  (cycle/from-list
+   '("#omg" "#london" "#panic" "#prod-team"))
+  "List of channels through which I can cycle.")
+
+;; Setting `erc-join-buffer' to 'bury prevents erc from stealing focus of the
+;; current buffer when it connects to IRC servers.
+(setq erc-join-buffer 'bury)
+
+(setq erc-autojoin-channels-alist
+      `(("corp.google.com" . ,(cycle/to-list irc/channels-cycle))))
+
+(defcustom irc/install-kbds? t
+  "When t, install the keybindings defined herein.")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Library
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun irc/message (x)
+  "Print message X in a structured way."
+  (message (string/format "[irc.el] %s" x)))
+
+(defun irc/connect-to-google ()
+  "Connect to Google's Corp IRC using ERC."
+  (interactive)
+  (erc-ssl :server "irc.corp.google.com"
+           :port 6697
+           :nick "wpcarro"
+           :full-name "William Carroll"))
+
+(defun irc/next-channel ()
+  "Join the next channel in `irc/channels-cycle'."
+  (interactive)
+  (erc-join-channel
+   (cycle/next irc/channels-cycle))
+  (irc/message
+   (string/format "Current IRC channel: %s"
+                  (cycle/current irc/channels-cycle))))
+
+(defun irc/prev-channel ()
+  "Join the previous channel in `irc/channels-cycle'."
+  (interactive)
+  (erc-join-channel
+   (cycle/prev irc/channels-cycle))
+  (irc/message
+   (string/format "Current IRC channel: %s"
+                  (cycle/current irc/channels-cycle))))
+
+(when irc/install-kbds?
+  (general-define-key
+   :keymaps 'erc-mode-map
+   "<C-tab>" #'irc/next-channel
+   "<C-S-iso-lefttab>" #'irc/prev-channel))
+
+(provide 'irc)
+;;; irc.el ends here