summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-circe.el55
1 files changed, 55 insertions, 0 deletions
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 @@
1;;; acdw-circe.el --- bespoke circe customizations -*- lexical-binding: t -*-
2
3;;; Commentary:
4
5;; Besoke Circe customizations.
6
7;;; Code:
8
9(require 'circe)
10
11;;; Chat commands
12(defun circe-command-SHORTEN (url)
13 "Shorten URL using `0x0-shorten-uri'."
14 (interactive "sURL to shorten: ")
15 (require '0x0)
16 ;; TODO: enable /shorten URL comment syntax
17 (let ((short-url (0x0-shorten-uri (0x0--choose-server) url)))
18 (circe-command-SAY short-url)))
19
20;;; Advices
21
22(defun circe-part@kill-buffer (&rest _)
23 "Advice to kill the channel buffer after PART."
24 (let ((circe-channel-killed-confirmation nil))
25 (kill-buffer)))
26
27(defun circe-quit@kill-buffer (&rest _)
28 "Advice to kill all buffers of a server after QUIT."
29 ;; `circe-server-killed-confirmation' set to nil, and manually
30 ;; deleting all chat buffers, pending Github issue #402
31 ;; (https://github.com/emacs-circe/circe/issues/402)
32 (let ((circe-server-killed-confirmation nil))
33 (with-circe-server-buffer
34 (dolist (buf (circe-server-chat-buffers))
35 (let ((circe-channel-killed-confirmation nil))
36 (kill-buffer buf)))
37 (kill-buffer))))
38
39(defun circe-gquit@kill-buffer (&rest _)
40 "Advice to kill all Circe related buffers after GQUIT."
41 ;; `circe-server-killed-confirmation' set to nil, and manually
42 ;; deleting all chat buffers, pending Github issue #402
43 ;; (https://github.com/emacs-circe/circe/issues/402)
44 (let ((circe-server-killed-confirmation nil))
45 (dolist (buf (circe-server-buffers))
46 (with-current-buffer buf
47 (dolist (buf (circe-server-chat-buffers))
48 (let ((circe-channel-killed-confirmation nil))
49 (kill-buffer buf))
50 (cancel-timer 'irc-send--queue))
51 (message "%s: %s" buf circe-server-killed-confirmation)
52 (kill-buffer)))))
53
54(provide 'acdw-circe)
55;;; acdw-circe.el ends here