From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- modules/erc-config.el | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 modules/erc-config.el (limited to 'modules/erc-config.el') diff --git a/modules/erc-config.el b/modules/erc-config.el new file mode 100644 index 00000000..ddc8f737 --- /dev/null +++ b/modules/erc-config.el @@ -0,0 +1,109 @@ +;;; erc-config --- Preferences for Emacs Relay Chat (IRC Client) -*- lexical-binding: t; -*- +;; author Craig Jennings + +;;; Commentary: + +;; The main entry point into ERC is the C-c C-c keybinding. +;; Channels in erc-autojoin-channels-alist will open in background. +;; After connecting, switch to any ERC buffer with C-c C-c. +;; Quit current channel with C-c C-p; Quit ERC altogether with C-c C-q + +;;; Code: + +;; ------------------------------------ ERC ------------------------------------ +;; Emacs Relay Chat - an IRC client + +(use-package erc + :defer 1 + :ensure nil ;; built-in + :commands (erc erc-tls) + :bind + ;; the global keybinding + ("C-c I" . 'cj/erc-start-or-switch) + (:map erc-mode-map + ;; overrides erc-toggle-interpret-controls + ("C-c I" . 'cj/erc-start-or-switch)) + :hook + (erc-mode . emojify-mode) + :custom + (erc-modules + '(autojoin + button + completion + fill + irccontrols + list + log + match + move-to-prompt + noncommands + notifications + readonly + services + stamp)) + + (erc-autojoin-channels-alist + '(("libera" + "#erc" + "#ledger" + "#emacs" + "#emacs-social" + "#zfsonlinux" + "#systemcrafters" + "#org-mode"))) + + (erc-nick "craigjennings") + (erc-user-full-name user-whole-name) + (erc-use-auth-source-for-nickserv-password t) + (erc-kill-buffer-on-part t) + (erc-kill-queries-on-quit t) + (erc-kill-server-buffer-on-quit t) + (erc-fill-column 120) + (erc-fill-function 'erc-fill-static) + (erc-fill-static-center 20) + + :config + ;; use all text mode abbrevs in ercmode + (abbrev-table-put erc-mode-abbrev-table :parents (list text-mode-abbrev-table)) + + ;; create log directory if it doesn't exist + (setq erc-log-channels-directory (concat user-emacs-directory "erc/logs/")) + (if (not (file-exists-p erc-log-channels-directory)) + (mkdir erc-log-channels-directory t))) + +;; --------------------------------- ERC Image --------------------------------- +;; show inlined images (png/jpg/gif/svg) in erc buffers. + +(use-package erc-image + :defer 1 + :after erc + :config + (setq erc-image-inline-rescale 300) + (add-to-list 'erc-modules 'image) + (erc-update-modules)) + +;; -------------------------------- ERC Hl Nicks ------------------------------- +;; uniquely identify names in ERC + +(use-package erc-hl-nicks + :defer 1 + :after erc + :config + (add-to-list 'erc-modules 'hl-nicks)) + +;; -------------------------------- Connect IRC -------------------------------- +;; convenience function to auto-connect to irc.libera.chat + +(defun cj/erc-start-or-switch () + "Start ERC or switch to ERC buffer if it has started already." + (interactive) + (if (get-buffer "Libera.Chat") + (erc-switch-to-buffer) + (erc-tls + :server "irc.libera.chat" + :port 6697 + :nick "craigjennings" + :full-name user-whole-name))) + +(provide 'erc-config) +;;; erc-config.el ends here -- cgit v1.2.3