From c5bba76bf872c9c249c9ec3652a9fd872975ca38 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 2 Sep 2021 17:07:25 -0500 Subject: Refactor Circe config --- init.el | 93 +++++++++++++++++++++++++------------------------------- lisp/acdw-irc.el | 23 ++++++++++++++ 2 files changed, 65 insertions(+), 51 deletions(-) diff --git a/init.el b/init.el index 4acc477..4478b97 100644 --- a/init.el +++ b/init.el @@ -1210,51 +1210,38 @@ like a dumbass." (require 'circe) (require 'acdw-irc) - (setq acdw-irc/post-my-nick "-> ") - - (setq circe-default-nick "acdw" - circe-default-part-message "See You, Space Cowpokes . . ." - circe-highlight-nick-type 'all - circe-network-options - `(("Libera Chat" - :channels ("#emacs" "#systemcrafters" "##webpals") - :sasl-username "acdw" - :sasl-password ,(acdw/fetch-password :host "libera.chat")) - ("Tilde Chat" - :channels ("#meta" "#bread" "#dadjokes" "#team") - :host "irc.tilde.chat" :port 6697 :use-tls t - :sasl-username "acdw" - :sasl-password ,(acdw/fetch-password :host "tilde.chat")) - ("Casa" - :channels ("#basement") - :host "m455.casa" :port 6697 :use-tls t - :sasl-username "acdw" - :sasl-password ,(acdw/fetch-password :host "m455.casa"))) - circe-reduce-lurker-spam t - circe-server-auto-join-default-type :after-auth) - - (defun irc () - "Connect to IRC." - (interactive) - (dolist (network (mapcar #'car circe-network-options)) - (circe-maybe-connect network))) - - (defun circe-network-connected-p (network) - "Return non-nil if there's any Circe server-buffer whose -`circe-server-netwok' is NETWORK." - (catch 'return - (dolist (buffer (circe-server-buffers)) - (with-current-buffer buffer - (if (string= network circe-server-network) - (throw 'return t)))))) - - (defun circe-maybe-connect (network) - "Connect to NETWORK, but ask user for confirmation if it's -already been connected to." - (interactive "sNetwork: ") - (if (or (not (circe-network-connected-p network)) - (y-or-n-p (format "Already connected to %s, reconnect?" network))) - (circe network))) + (:option acdw-irc/post-my-nick "-> " + circe-color-nicks-everywhere t + circe-default-nick "acdw" + circe-default-part-message "See You, Space Cowpokes . . ." + circe-default-user "acdw" + circe-highlight-nick-type 'sender + circe-network-options + `(("Libera Chat" + :channels ("#emacs" "#systemcrafters" "##webpals") + :sasl-username "acdw" + :sasl-password ,(acdw/fetch-password :host "libera.chat")) + ("Tilde Chat" + :channels ("#meta" "#bread" "#dadjokes" "#team") + :host "irc.tilde.chat" :port 6697 :use-tls t + :sasl-username "acdw" + :sasl-password ,(acdw/fetch-password :host "tilde.chat")) + ("Casa" + :channels ("#basement") + :host "m455.casa" :port 6697 :use-tls t + :sasl-username "acdw" + :sasl-password ,(acdw/fetch-password :host "m455.casa"))) + circe-reduce-lurker-spam t + circe-server-auto-join-default-type :after-auth) + + (custom-set-faces '(circe-nick-highlight-face + ((t (:inherit (modus-themes-hl-line)))) + :now)) + + (defface highlight + '((t :inverse-video t)) + "Basic face for highlighting." + :group 'basic-faces) (add-hook 'circe-chat-mode-hook (defun circe-chat@setup () @@ -1270,6 +1257,9 @@ already been connected to." (enable-circe-display-images) (enable-circe-new-day-notifier))) + (add-hook 'circe-chat-mode-hook #'acdw/stop-paren-annoyances) + + (autoload 'circe-nick-color-reset "circe-color-nicks") (add-hook 'modus-themes-after-load-theme-hook #'circe-nick-color-reset) @@ -1302,19 +1292,20 @@ already been connected to." " ") " "))) - (setq lui-time-stamp-position 'right-margin - lui-time-stamp-format "%H:%M") + (:option lui-fill-column fill-column + lui-time-stamp-position 'right-margin + lui-time-stamp-format "%H:%M" + lui-track-behavior 'before-switch-to-buffer + lui-track-indicator 'fringe) + (add-hook 'lui-mode-hook (defun lui-mode@setup () (setq-local fringes-outside-margins t - lui-track-bar-behavior 'before-switch-to-buffer right-margin-width 5 scroll-margin 0 word-wrap t wrap-prefix (repeat-string - acdw-irc/left-margin " ")) - ;; (enable-lui-track-bar) - ))) + acdw-irc/left-margin " "))))) (setup (:straight crux) diff --git a/lisp/acdw-irc.el b/lisp/acdw-irc.el index 193275c..0891f31 100644 --- a/lisp/acdw-irc.el +++ b/lisp/acdw-irc.el @@ -79,6 +79,29 @@ and right on t." (if alignment "" (repeat-string left-over " ")) after))) +(defun irc () + "Connect to all IRC networks in `circe-network-options'." + (interactive) + (dolist (network (mapcar #'car circe-network-options)) + (circe-maybe-connect network))) + +(defun circe-network-connected-p (network) + "Return non-nil if there's any Circe server-buffer whose +`circe-server-netwok' is NETWORK." + (catch 'return + (dolist (buffer (circe-server-buffers)) + (with-current-buffer buffer + (if (string= network circe-server-network) + (throw 'return t)))))) + +(defun circe-maybe-connect (network) + "Connect to NETWORK, but ask user for confirmation if it's +already been connected to." + (interactive "sNetwork: ") + (if (or (not (circe-network-connected-p network)) + (y-or-n-p (format "Already connected to %s, reconnect?" network))) + (circe network))) + (provide 'acdw-irc) ;;; acdw-irc.el ends here -- cgit 1.4.1-21-gabe81