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: erc-kill-buffer-stay Date: Tue, 26 Feb 2019 20:13:24 +0100 Message-ID: <86ef7uuzvv.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="142429"; 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 Tue Feb 26 20:14:11 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 1gyiB7-000auB-0I for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Feb 2019 20:14:09 +0100 Original-Received: from localhost ([127.0.0.1]:59965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyiB5-000769-O4 for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Feb 2019 14:14:07 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyiAg-00073x-6R for help-gnu-emacs@gnu.org; Tue, 26 Feb 2019 14:13:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyiAe-0006dr-M2 for help-gnu-emacs@gnu.org; Tue, 26 Feb 2019 14:13:42 -0500 Original-Received: from [195.159.176.226] (port=58246 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyiAe-0006bq-Cs for help-gnu-emacs@gnu.org; Tue, 26 Feb 2019 14:13:40 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1gyiAa-000aNI-G7 for help-gnu-emacs@gnu.org; Tue, 26 Feb 2019 20:13:36 +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:76U8HAClJfPsfQEppHpdMZX6TnQ= 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:119532 gmane.emacs.erc.general:1455 Archived-At: Is something like this already present in ERC? If so I didn't find it, and I think it is very handy. 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) ))))) More ERC stuff: http://user.it.uu.se/~embe8573/emacs-init/erc-my.el -- underground experts united http://user.it.uu.se/~embe8573