unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Bob Proulx <bob@proulx.com>
To: help-gnu-emacs@gnu.org
Subject: Re: erc-kill-buffer-stay
Date: Tue, 26 Feb 2019 12:38:39 -0700	[thread overview]
Message-ID: <20190226122219763066763@bob.proulx.com> (raw)
In-Reply-To: <86ef7uuzvv.fsf@zoho.eu>

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



  reply	other threads:[~2019-02-26 19:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 19:13 erc-kill-buffer-stay Emanuel Berg
2019-02-26 19:38 ` Bob Proulx [this message]
2019-02-27  8:58   ` erc-kill-buffer-stay Emanuel Berg
2019-03-01 16:33   ` erc-kill-buffer-stay Emanuel Berg
2019-02-26 20:43 ` erc-kill-buffer-stay Bad Blue Bull
2019-02-26 20:50   ` erc-kill-buffer-stay Emanuel Berg
2019-02-26 22:31 ` erc-kill-buffer-stay Bad Blue Bull
2019-02-27  8:59   ` erc-kill-buffer-stay Emanuel Berg
2019-03-13 20:33   ` erc-kill-buffer-stay Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190226122219763066763@bob.proulx.com \
    --to=bob@proulx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).