unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <moasenwood@zoho.eu>
To: help-gnu-emacs@gnu.org
Cc: erc-discuss@gnu.org
Subject: Re: erc-kill-buffer-stay
Date: Fri, 01 Mar 2019 17:33:03 +0100	[thread overview]
Message-ID: <868sxyr1vk.fsf@zoho.eu> (raw)
In-Reply-To: 20190226122219763066763@bob.proulx.com

> 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




  parent reply	other threads:[~2019-03-01 16:33 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 ` erc-kill-buffer-stay Bob Proulx
2019-02-27  8:58   ` erc-kill-buffer-stay Emanuel Berg
2019-03-01 16:33   ` Emanuel Berg [this message]
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=868sxyr1vk.fsf@zoho.eu \
    --to=moasenwood@zoho.eu \
    --cc=erc-discuss@gnu.org \
    --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).