From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help,gmane.emacs.erc.general Subject: Re: erc-kill-buffer-stay Date: Fri, 01 Mar 2019 17:33:03 +0100 Message-ID: <868sxyr1vk.fsf@zoho.eu> References: <86ef7uuzvv.fsf@zoho.eu> <20190226122219763066763@bob.proulx.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="208008"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cc: erc-discuss@gnu.org To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 01 17:37:45 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gzlAN-000ryO-SJ for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Mar 2019 17:37:44 +0100 Original-Received: from localhost ([127.0.0.1]:40429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzlAM-0003Oq-Mf for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Mar 2019 11:37:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzl63-0000FI-JL for help-gnu-emacs@gnu.org; Fri, 01 Mar 2019 11:33:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzl62-0006eI-3i for help-gnu-emacs@gnu.org; Fri, 01 Mar 2019 11:33:14 -0500 Original-Received: from [195.159.176.226] (port=47926 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gzl61-0006bx-PX for help-gnu-emacs@gnu.org; Fri, 01 Mar 2019 11:33:14 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1gzl5x-000lkv-EC for help-gnu-emacs@gnu.org; Fri, 01 Mar 2019 17:33:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Followup-To: gmane.emacs.help Mail-Copies-To: never Cancel-Lock: sha1:Pw0TKGy0c8eqdBrAKxI3Yfl7heo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119549 gmane.emacs.erc.general:1461 Archived-At: > 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