diff options
Diffstat (limited to '.config/emacs/modules')
-rw-r--r-- | .config/emacs/modules/bd--irc.el | 21 |
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 |