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 --- lisp/acdw-irc.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lisp') 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