From d19fb84fbbdc1363a52cc3bd3723e4dda75812f3 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 28 Sep 2021 16:20:55 -0500 Subject: Add acdw-circe.el --- lisp/acdw-circe.el | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lisp/acdw-circe.el (limited to 'lisp') diff --git a/lisp/acdw-circe.el b/lisp/acdw-circe.el new file mode 100644 index 0000000..69b10be --- /dev/null +++ b/lisp/acdw-circe.el @@ -0,0 +1,55 @@ +;;; acdw-circe.el --- bespoke circe customizations -*- lexical-binding: t -*- + +;;; Commentary: + +;; Besoke Circe customizations. + +;;; Code: + +(require 'circe) + +;;; Chat commands +(defun circe-command-SHORTEN (url) + "Shorten URL using `0x0-shorten-uri'." + (interactive "sURL to shorten: ") + (require '0x0) + ;; TODO: enable /shorten URL comment syntax + (let ((short-url (0x0-shorten-uri (0x0--choose-server) url))) + (circe-command-SAY short-url))) + +;;; Advices + +(defun circe-part@kill-buffer (&rest _) + "Advice to kill the channel buffer after PART." + (let ((circe-channel-killed-confirmation nil)) + (kill-buffer))) + +(defun circe-quit@kill-buffer (&rest _) + "Advice to kill all buffers of a server after QUIT." + ;; `circe-server-killed-confirmation' set to nil, and manually + ;; deleting all chat buffers, pending Github issue #402 + ;; (https://github.com/emacs-circe/circe/issues/402) + (let ((circe-server-killed-confirmation nil)) + (with-circe-server-buffer + (dolist (buf (circe-server-chat-buffers)) + (let ((circe-channel-killed-confirmation nil)) + (kill-buffer buf))) + (kill-buffer)))) + +(defun circe-gquit@kill-buffer (&rest _) + "Advice to kill all Circe related buffers after GQUIT." + ;; `circe-server-killed-confirmation' set to nil, and manually + ;; deleting all chat buffers, pending Github issue #402 + ;; (https://github.com/emacs-circe/circe/issues/402) + (let ((circe-server-killed-confirmation nil)) + (dolist (buf (circe-server-buffers)) + (with-current-buffer buf + (dolist (buf (circe-server-chat-buffers)) + (let ((circe-channel-killed-confirmation nil)) + (kill-buffer buf)) + (cancel-timer 'irc-send--queue)) + (message "%s: %s" buf circe-server-killed-confirmation) + (kill-buffer))))) + +(provide 'acdw-circe) +;;; acdw-circe.el ends here -- cgit 1.4.1-21-gabe81