From 657ff5f26272bd305e654ced1ba29713dceea993 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Thu, 7 Oct 2021 19:05:55 -0700 Subject: Tidy-up irc.el Move the variable definitions to the top of the module. --- emacs/.emacs.d/wpc/irc.el | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'emacs/.emacs.d/wpc/irc.el') diff --git a/emacs/.emacs.d/wpc/irc.el b/emacs/.emacs.d/wpc/irc.el index 08e4d1eb15..f221db9eb9 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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -- cgit 1.4.1