summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-09-02 17:07:25 -0500
committerCase Duckworth2021-09-02 17:07:25 -0500
commitc5bba76bf872c9c249c9ec3652a9fd872975ca38 (patch)
tree6a87775292f5fb4e36e77942de4c6a3a59e32aa2
parentComment out buggy eww-browse-url advice (diff)
downloademacs-c5bba76bf872c9c249c9ec3652a9fd872975ca38.tar.gz
emacs-c5bba76bf872c9c249c9ec3652a9fd872975ca38.zip
Refactor Circe config
-rw-r--r--init.el93
-rw-r--r--lisp/acdw-irc.el23
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."
1210 (require 'circe) 1210 (require 'circe)
1211 (require 'acdw-irc) 1211 (require 'acdw-irc)
1212 1212
1213 (setq acdw-irc/post-my-nick "-> ") 1213 (:option acdw-irc/post-my-nick "-> "
1214 1214 circe-color-nicks-everywhere t
1215 (setq circe-default-nick "acdw" 1215 circe-default-nick "acdw"
1216 circe-default-part-message "See You, Space Cowpokes . . ." 1216 circe-default-part-message "See You, Space Cowpokes . . ."
1217 circe-highlight-nick-type 'all 1217 circe-default-user "acdw"
1218 circe-network-options 1218 circe-highlight-nick-type 'sender
1219 `(("Libera Chat" 1219 circe-network-options
1220 :channels ("#emacs" "#systemcrafters" "##webpals") 1220 `(("Libera Chat"
1221 :sasl-username "acdw" 1221 :channels ("#emacs" "#systemcrafters" "##webpals")
1222 :sasl-password ,(acdw/fetch-password :host "libera.chat")) 1222 :sasl-username "acdw"
1223 ("Tilde Chat" 1223 :sasl-password ,(acdw/fetch-password :host "libera.chat"))
1224 :channels ("#meta" "#bread" "#dadjokes" "#team") 1224 ("Tilde Chat"
1225 :host "irc.tilde.chat" :port 6697 :use-tls t 1225 :channels ("#meta" "#bread" "#dadjokes" "#team")
1226 :sasl-username "acdw" 1226 :host "irc.tilde.chat" :port 6697 :use-tls t
1227 :sasl-password ,(acdw/fetch-password :host "tilde.chat")) 1227 :sasl-username "acdw"
1228 ("Casa" 1228 :sasl-password ,(acdw/fetch-password :host "tilde.chat"))
1229 :channels ("#basement") 1229 ("Casa"
1230 :host "m455.casa" :port 6697 :use-tls t 1230 :channels ("#basement")
1231 :sasl-username "acdw" 1231 :host "m455.casa" :port 6697 :use-tls t
1232 :sasl-password ,(acdw/fetch-password :host "m455.casa"))) 1232 :sasl-username "acdw"
1233 circe-reduce-lurker-spam t 1233 :sasl-password ,(acdw/fetch-password :host "m455.casa")))
1234 circe-server-auto-join-default-type :after-auth) 1234 circe-reduce-lurker-spam t
1235 1235 circe-server-auto-join-default-type :after-auth)
1236 (defun irc () 1236
1237 "Connect to IRC." 1237 (custom-set-faces '(circe-nick-highlight-face
1238 (interactive) 1238 ((t (:inherit (modus-themes-hl-line))))
1239 (dolist (network (mapcar #'car circe-network-options)) 1239 :now))
1240 (circe-maybe-connect network))) 1240
1241 1241 (defface highlight
1242 (defun circe-network-connected-p (network) 1242 '((t :inverse-video t))
1243 "Return non-nil if there's any Circe server-buffer whose 1243 "Basic face for highlighting."
1244`circe-server-netwok' is NETWORK." 1244 :group 'basic-faces)
1245 (catch 'return
1246 (dolist (buffer (circe-server-buffers))
1247 (with-current-buffer buffer
1248 (if (string= network circe-server-network)
1249 (throw 'return t))))))
1250
1251 (defun circe-maybe-connect (network)
1252 "Connect to NETWORK, but ask user for confirmation if it's
1253already been connected to."
1254 (interactive "sNetwork: ")
1255 (if (or (not (circe-network-connected-p network))
1256 (y-or-n-p (format "Already connected to %s, reconnect?" network)))
1257 (circe network)))
1258 1245
1259 (add-hook 'circe-chat-mode-hook 1246 (add-hook 'circe-chat-mode-hook
1260 (defun circe-chat@setup () 1247 (defun circe-chat@setup ()
@@ -1270,6 +1257,9 @@ already been connected to."
1270 (enable-circe-display-images) 1257 (enable-circe-display-images)
1271 (enable-circe-new-day-notifier))) 1258 (enable-circe-new-day-notifier)))
1272 1259
1260 (add-hook 'circe-chat-mode-hook #'acdw/stop-paren-annoyances)
1261
1262 (autoload 'circe-nick-color-reset "circe-color-nicks")
1273 (add-hook 'modus-themes-after-load-theme-hook 1263 (add-hook 'modus-themes-after-load-theme-hook
1274 #'circe-nick-color-reset) 1264 #'circe-nick-color-reset)
1275 1265
@@ -1302,19 +1292,20 @@ already been connected to."
1302 " ") 1292 " ")
1303 " "))) 1293 " ")))
1304 1294
1305 (setq lui-time-stamp-position 'right-margin 1295 (:option lui-fill-column fill-column
1306 lui-time-stamp-format "%H:%M") 1296 lui-time-stamp-position 'right-margin
1297 lui-time-stamp-format "%H:%M"
1298 lui-track-behavior 'before-switch-to-buffer
1299 lui-track-indicator 'fringe)
1300
1307 (add-hook 'lui-mode-hook 1301 (add-hook 'lui-mode-hook
1308 (defun lui-mode@setup () 1302 (defun lui-mode@setup ()
1309 (setq-local fringes-outside-margins t 1303 (setq-local fringes-outside-margins t
1310 lui-track-bar-behavior 'before-switch-to-buffer
1311 right-margin-width 5 1304 right-margin-width 5
1312 scroll-margin 0 1305 scroll-margin 0
1313 word-wrap t 1306 word-wrap t
1314 wrap-prefix (repeat-string 1307 wrap-prefix (repeat-string
1315 acdw-irc/left-margin " ")) 1308 acdw-irc/left-margin " ")))))
1316 ;; (enable-lui-track-bar)
1317 )))
1318 1309
1319(setup (:straight crux) 1310(setup (:straight crux)
1320 1311
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."
79 (if alignment "" (repeat-string left-over " ")) 79 (if alignment "" (repeat-string left-over " "))
80 after))) 80 after)))
81 81
82(defun irc ()
83 "Connect to all IRC networks in `circe-network-options'."
84 (interactive)
85 (dolist (network (mapcar #'car circe-network-options))
86 (circe-maybe-connect network)))
87
88(defun circe-network-connected-p (network)
89 "Return non-nil if there's any Circe server-buffer whose
90`circe-server-netwok' is NETWORK."
91 (catch 'return
92 (dolist (buffer (circe-server-buffers))
93 (with-current-buffer buffer
94 (if (string= network circe-server-network)
95 (throw 'return t))))))
96
97(defun circe-maybe-connect (network)
98 "Connect to NETWORK, but ask user for confirmation if it's
99already been connected to."
100 (interactive "sNetwork: ")
101 (if (or (not (circe-network-connected-p network))
102 (y-or-n-p (format "Already connected to %s, reconnect?" network)))
103 (circe network)))
104
82 105
83(provide 'acdw-irc) 106(provide 'acdw-irc)
84;;; acdw-irc.el ends here 107;;; acdw-irc.el ends here