[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: erc-kill-buffer-stay
From: |
Bob Proulx |
Subject: |
Re: erc-kill-buffer-stay |
Date: |
Tue, 26 Feb 2019 12:38:39 -0700 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Emanuel Berg wrote:
> Is something like this already present in ERC?
> If so I didn't find it, and I think it is very
> handy.
I don't know but wanted to ask about not seeing a channel PART in the
routine.
> Also feel free to suggest improvements to the code, as alays.
> (defun erc-kill-buffer-stay ()
> "Close the current ERC buffer (i.e., leave the channel)
> but stay in ERC."
> (interactive)
> (when (or (not (erc-server-buffer-live-p))
> (= ?y (read-char "press `y' to leave the channel")) )
> (let ((erc-buffers (erc-buffer-list)))
> (if (= 1 (length erc-buffers)) (kill-buffer)
> (cl-loop for b in erc-buffers
> when (neq b (current-buffer))
> do (kill-buffer)
> (switch-to-buffer b)
> (cl-return) )))))
Are you counting on erc-kill-channel-hook to contain erc-kill-channel
(by default it does) to have it leave /PART the channel?
AFAIK erc-kill-buffer-function calls erc-kill-channel-hook which by
default contains erc-kill-channel function.
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/erc/erc.el#n6724
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/erc/erc.el#n6761
I found that behavior of channel parting incompatible when using an
irc bouncer proxy as the entire purpose of the proxy is to remain
connected when the client disconnects. Therefore when using an irc
bouncer such as ZNC or others one *must* remove erc-kill-channel from
erc-kill-channel-hook or nothing works as desired.
I think for robustness it should explicitly erc-cmd-PART in there
somewhere. Try it with the hook removed to see what I mean.
(remove-hook 'erc-kill-channel-hook 'erc-kill-channel) ; or (setq
erc-kill-channel-hook nil)
Bob