From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Friedrich Dominicus Newsgroups: gmane.emacs.help Subject: Re: Killing Buffers Date: Mon, 29 Dec 2003 07:27:32 +0100 Organization: Q Software Solutions GmbH Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <873cb4b0kr.fsf@fbigm.here> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1072680456 7647 80.91.224.253 (29 Dec 2003 06:47:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 29 Dec 2003 06:47:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 29 07:47:29 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AarBY-0003xy-00 for ; Mon, 29 Dec 2003 07:47:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Aas6N-00053c-EM for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Dec 2003 02:46:11 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-X-Trace: news.t-online.com 1072679357 07 24810 t5nJGg+rK9QpvAk 031229 06:29:17 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: XdbC4qZF8eL-bfYkwBwOFdLMtkDWlE+fbHezVXIkR9vUv8jRNtPz6z User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) Cancel-Lock: sha1:9ahh3TLTUb2g1jycs1VDPnLU/1w= Original-Xref: shelby.stanford.edu gnu.emacs.help:119672 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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 Xref: main.gmane.org gmane.emacs.help:15614 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15614 Edward Wijaya writes: > Hi, > > I am looking for a key that: > 1. Kill all the existing buffer without having have to close Emacs > 2. Kill all the existing buffer "except" the active one. > > Does anybody know the shortcut key for that? Something like that could do the job (require 'cl) (defun kill-all-buffers-except (prefix) (interactive "P") (let ((cur-buf-name (buffer-name nil)) (buf-list (buffer-list))) (when prefix (setf buf-list (delete-if #'(lambda (buf) (string= (buffer-name buf) cur-buf-name)) buf-list))) (map 'nil #'kill-buffer buf-list))) You can bind it to whatever key you like. If you give it prefix C-u than all but the current buffer is killed. Otherwise all is killed but one buffer. One buffer is open all the time. Regards Friedrich