diff options
author | William Carroll <wpcarro@gmail.com> | 2021-10-08T02·05-0700 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2021-10-08T02·05-0700 |
commit | 657ff5f26272bd305e654ced1ba29713dceea993 (patch) | |
tree | 04d65927f1fdc9eb7f5ec490ed554e0350f04b30 | |
parent | a8a8cb9a250e12ec79b24d3f9c46c17f2a4c185e (diff) |
Tidy-up irc.el
Move the variable definitions to the top of the module.
-rw-r--r-- | emacs/.emacs.d/wpc/irc.el | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/emacs/.emacs.d/wpc/irc.el b/emacs/.emacs.d/wpc/irc.el index 08e4d1eb152c..f221db9eb9e0 100644 --- a/emacs/.emacs.d/wpc/irc.el +++ b/emacs/.emacs.d/wpc/irc.el @@ -30,22 +30,34 @@ ;; Configuration ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defcustom irc-install-kbds? t + "When t, install the keybindings defined herein.") (setq erc-rename-buffers t) +;; 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) + ;; TODO: Find a way to avoid putting "freenode" and "#freenode" as channels ;; here. I'm doing it because when erc first connects, it's `(buffer-name)' is ;; "freenode", so when `irc-next-channel' is called, it 404s on the ;; `cycle-contains?' call in `irc-channel->cycle" unless "freenode" is there. To ;; make matters even uglier, when `erc-join-channel' is called with "freenode" ;; as the value, it connects to the "#freenode" channel, so unless "#freenode" -;; exists in this cycle also, `irc-next-channel' breaks again. This doesn't -;; pass my smell test. +;; exists in this cycle also, `irc-next-channel' breaks again. (defconst irc-server->channels `(("irc.freenode.net" . ,(cycle-new "freenode" "#freenode" "#nixos" "#emacs" "#pass")) - ("irc.corp.google.com" . ,(cycle-new "#omg" "#london" "#panic" "#prod-team"))) + ("irc.corp.google.com" . ,(cycle-new "#drive-prod"))) "Mapping of IRC servers to a cycle of my preferred channels.") +;; TODO: Here is another horrible hack that should be revisted. +(setq erc-autojoin-channels-alist + (->> irc-server->channels + (al-map-values #'cycle-to-list) + (al-map-keys (>-> (s-chop-prefix "irc.") + (s-chop-suffix ".net"))))) + ;; TODO: Assert that no two servers have a channel with the same name. We need ;; this because that's the assumption that underpins the `irc-channel->server' ;; function. This will probably be an O(n^2) operation. @@ -71,20 +83,6 @@ (al-get (irc-channel->server server->channels channel) server->channels)) -;; 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) - -;; TODO: Here is another horrible hack that should be revisted. -(setq erc-autojoin-channels-alist - (->> irc-server->channels - (al-map-values #'cycle-to-list) - (al-map-keys (>-> (s-chop-prefix "irc.") - (s-chop-suffix ".net"))))) - -(defcustom irc-install-kbds? t - "When t, install the keybindings defined herein.") - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Library ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |