diff options
-rw-r--r-- | init.el | 48 | ||||
-rw-r--r-- | lisp/acdw-circe.el | 55 |
2 files changed, 61 insertions, 42 deletions
diff --git a/init.el b/init.el index 11c9e71..a5efd8b 100644 --- a/init.el +++ b/init.el | |||
@@ -1026,9 +1026,9 @@ specific to most general, they are these: | |||
1026 | (setup (:straight circe) | 1026 | (setup (:straight circe) |
1027 | (require 'circe) | 1027 | (require 'circe) |
1028 | (require 'acdw-irc) | 1028 | (require 'acdw-irc) |
1029 | (:also-load acdw-circe) | ||
1029 | 1030 | ||
1030 | (:option acdw-irc/left-margin 20 | 1031 | (:option acdw-irc/left-margin 20 |
1031 | acdw-irc/post-my-nick "-> " | ||
1032 | circe-channel-killed-confirmation nil | 1032 | circe-channel-killed-confirmation nil |
1033 | circe-color-nicks-everywhere t | 1033 | circe-color-nicks-everywhere t |
1034 | circe-default-nick "acdw" | 1034 | circe-default-nick "acdw" |
@@ -1084,44 +1084,9 @@ specific to most general, they are these: | |||
1084 | (:bind "C-c C-p" #'circe-command-PART | 1084 | (:bind "C-c C-p" #'circe-command-PART |
1085 | "C-l" #'lui-track-jump-to-indicator) | 1085 | "C-l" #'lui-track-jump-to-indicator) |
1086 | 1086 | ||
1087 | (:advise circe-command-PART :after | 1087 | (:advise circe-command-PART :after #'circe-part@kill-buffer |
1088 | (defun circe-part@kill-buffer (&rest _) | 1088 | circe-command-QUIT :after #'circe-quit@kill-buffer |
1089 | (let ((circe-channel-killed-confirmation nil)) | 1089 | circe-command-GQUIT :after #'circe-gquit@kill-buffer) |
1090 | (kill-buffer))) | ||
1091 | |||
1092 | circe-command-QUIT :after | ||
1093 | (defun circe-quit@kill-buffer (&rest _) | ||
1094 | ;; `circe-server-killed-confirmation' set to nil, and manually | ||
1095 | ;; deleting all chat buffers, pending Github issue #402 | ||
1096 | ;; (https://github.com/emacs-circe/circe/issues/402) | ||
1097 | (let ((circe-server-killed-confirmation nil)) | ||
1098 | (with-circe-server-buffer | ||
1099 | (dolist (buf (circe-server-chat-buffers)) | ||
1100 | (let ((circe-channel-killed-confirmation nil)) | ||
1101 | (kill-buffer buf))) | ||
1102 | (kill-buffer)))) | ||
1103 | |||
1104 | circe-command-GQUIT :after | ||
1105 | (defun circe-gquit@kill-buffer (&rest _) | ||
1106 | ;; `circe-server-killed-confirmation' set to nil, and manually | ||
1107 | ;; deleting all chat buffers, pending Github issue #402 | ||
1108 | ;; (https://github.com/emacs-circe/circe/issues/402) | ||
1109 | (let ((circe-server-killed-confirmation nil)) | ||
1110 | (dolist (buf (circe-server-buffers)) | ||
1111 | (with-current-buffer buf | ||
1112 | (dolist (buf (circe-server-chat-buffers)) | ||
1113 | (let ((circe-channel-killed-confirmation nil)) | ||
1114 | (kill-buffer buf)) | ||
1115 | (cancel-timer 'irc-send--queue)) | ||
1116 | (message "%s: %s" buf circe-server-killed-confirmation) | ||
1117 | (kill-buffer)))))) | ||
1118 | |||
1119 | (defun circe-command-SHORTEN (url) | ||
1120 | "Shorten URL using `0x0-shorten-uri'." | ||
1121 | (interactive "sURL to shorten: ") | ||
1122 | ;; TODO: enable /shorten URL comment syntax | ||
1123 | (let ((short-url (0x0-shorten-uri (0x0--choose-server) url))) | ||
1124 | (circe-command-SAY short-url))) | ||
1125 | 1090 | ||
1126 | (:with-mode circe-chat-mode | 1091 | (:with-mode circe-chat-mode |
1127 | (:hook #'acdw/stop-paren-annoyances | 1092 | (:hook #'acdw/stop-paren-annoyances |
@@ -1132,12 +1097,11 @@ specific to most general, they are these: | |||
1132 | (lui-set-prompt | 1097 | (lui-set-prompt |
1133 | (concat | 1098 | (concat |
1134 | (propertize | 1099 | (propertize |
1135 | (acdw-irc/margin-format (buffer-name) "" ">") | 1100 | (acdw-irc/margin-format (buffer-name) " " "> ") |
1136 | 'face 'circe-prompt-face | 1101 | 'face 'circe-prompt-face |
1137 | 'read-only t | 1102 | 'read-only t |
1138 | 'intangible t | 1103 | 'intangible t |
1139 | 'cursor-intangible t) | 1104 | 'cursor-intangible t)))))) |
1140 | " "))))) | ||
1141 | 1105 | ||
1142 | (autoload 'circe-nick-color-reset "circe-color-nicks") | 1106 | (autoload 'circe-nick-color-reset "circe-color-nicks") |
1143 | (add-hook 'modus-themes-after-load-theme-hook | 1107 | (add-hook 'modus-themes-after-load-theme-hook |
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 | ||