[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "*** #debian: You're not on that channel"

From: J.P.
Subject: Re: "*** #debian: You're not on that channel"
Date: Thu, 27 Jan 2022 06:27:09 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Emanuel Berg via General discussion about ERC <emacs-erc@gnu.org>

> (defun erc-kill-buffer-cycle ()
>   (let ((erc-buffers (erc-buffer-list)))
>     (if (= 1 (length erc-buffers))
>         (kill-buffer)
>       (let ((current-buffer (current-buffer)))
>         (cl-loop
>          for b in erc-buffers
>          when (not (eq b current-buffer))
>          do (erc-cmd-PART "")
>             (kill-buffer)
>             (switch-to-buffer b)
>             (cl-return) )))))

It looks as though you originally meant to make each b current in the
loop body. I think that's still the way to go because when called with
the empty string, `erc-cmd-PART' uses whatever default target belongs to
the current buffer.

The API does offer `erc-with-all-buffers-of-server', which can be a
little awkward to use (its indentation should probably be 2 instead
of 1), but it does the job. It can be made to visit all ERC buffers if
you pass nil for the first argument.

There's also `erc-kill-channel'. To the dismay of some, it's a member of
`erc-kill-channel-hook' by default. If that remains so with your setup,
then you shouldn't have to mess with `erc-cmd-PART' at all. Just make
sure that `erc-kill-buffer-function' indeed runs when a buffer is

reply via email to

[Prev in Thread] Current Thread [Next in Thread]