help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: erc-kill-buffer-stay


From: Emanuel Berg
Subject: Re: erc-kill-buffer-stay
Date: Fri, 01 Mar 2019 17:33:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

> Are you counting on erc-kill-channel-hook to
> contain erc-kill-channel (by default it does)
> to have it leave /PART the channel?

OK, I replaced `kill-buffer' with
`erc-kill-channel'!

I also made a check for an ERC process
(`erc-server-process-alive') so if there is no
process, it won't bother asking whether one
would like to "remain" in the channel.

(defun erc-kill-buffer-cycle ()
  (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 (erc-kill-channel)
                  (switch-to-buffer b)
                  (cl-return) ))))

(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-process-alive))
            (= ?y (read-char "press `y' to leave the channel")))
    (erc-kill-buffer-cycle) ))


Source and more ERC stuff:

    http://user.it.uu.se/~embe8573/emacs-init/erc-my.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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