summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-09-01 23:16:01 -0400
committerbd <bdunahu@operationnull.com>2025-09-01 23:16:01 -0400
commit5b57382887e2f1e1cff2687be2b6739f3f76f5c0 (patch)
treee294c4b2cbc63d3fb00a423db6630fc535e7f93e /.config
parentf9b63ccda2ed173bdae947cd7e43a57c736fefb1 (diff)
rcirc shortcut to detach and kill buffer
Diffstat (limited to '.config')
-rw-r--r--.config/emacs/modules/bd--irc.el21
1 files changed, 20 insertions, 1 deletions
diff --git a/.config/emacs/modules/bd--irc.el b/.config/emacs/modules/bd--irc.el
index c07a4fe..fe2d58f 100644
--- a/.config/emacs/modules/bd--irc.el
+++ b/.config/emacs/modules/bd--irc.el
@@ -6,7 +6,8 @@
(require 'fill-column)
(use-package rcirc
:bind (:map rcirc-mode-map
- ("C-c j" . #'bd/rcirc-jump-net))
+ ("C-c j" . #'bd/rcirc-jump-net)
+ ("C-c q" . #'bd/rcirc-detach-buffer))
:hook
((rcirc-mode . (lambda ()
(setq-local fill-column-desired-width 80)
@@ -26,6 +27,24 @@ ZNC to hop networks."
(rcirc-send-string (rcirc-buffer-process)
"PRIVMSG" "*status" :
(concat "JUMPNETWORK " target)))))))
+ (defun bd/rcirc-detach-buffer ()
+ "If the current buffer is an rcirc channel, detaches through ZNC and
+deletes the buffer. This bypasses the default behavior of deleting an active
+channel, which is issuing the PART command."
+ (interactive)
+ (let ((buffer (current-buffer)))
+ (when (and (rcirc-buffer-process)
+ (eq (process-status (rcirc-buffer-process)) 'open))
+ (with-rcirc-server-buffer
+ (setq rcirc-buffer-alist
+ (rassq-delete-all buffer rcirc-buffer-alist)))
+ (rcirc-update-short-buffer-names)
+ (if (rcirc-channel-p rcirc-target)
+ (rcirc-send-string (rcirc-buffer-process)
+ "PRIVMSG" "*status" :
+ (concat "DETACH " rcirc-target))))
+ (setq rcirc-target nil)
+ (kill-buffer buffer)))
(setopt rcirc-fill-column 80
rcirc-omit-threshold 10
rcirc-reconnect-delay 60