From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "RealityMonster" Newsgroups: gmane.emacs.help Subject: Re: how can i kill all the buffers Date: 31 Jan 2007 17:02:09 -0800 Organization: http://groups.google.com Message-ID: <1170291729.222129.81800@l53g2000cwa.googlegroups.com> References: <1170170369.232375.163210@h3g2000cwc.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1170294061 8758 80.91.229.12 (1 Feb 2007 01:41:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Feb 2007 01:41:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 01 02:40:36 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HCQwF-0003ou-EJ for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Feb 2007 02:40:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HCQwF-0000bI-0X for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Jan 2007 20:40:35 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!l53g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-NNTP-Posting-Host: 204.50.199.4 Original-X-Trace: posting.google.com 1170291734 21633 127.0.0.1 (1 Feb 2007 01:02:14 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 1 Feb 2007 01:02:14 +0000 (UTC) In-Reply-To: <1170170369.232375.163210@h3g2000cwc.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: l53g2000cwa.googlegroups.com; posting-host=204.50.199.4; posting-account=anCfDA0AAADtSwHBlZjdklEITqJ7uNPT Original-Xref: shelby.stanford.edu gnu.emacs.help:145205 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:40811 Archived-At: On Jan 30, 8:19 am, "step" wrote: > 1. this is any command to kill all buffers ,not close the emacs > > 2. if only i want to close the buffers of some mode (ep: c > files),can i do it? > > 3x I took kill-some-buffers and modified it a bit. (defun kill-all-buffers (&optional list) "For each buffer in LIST, kill it. If it's been modified don't do anything. LIST defaults to all existing live buffers." (interactive) (if (null list) (setq list (buffer-list))) (while list (let* ((buffer (car list)) (name (buffer-name buffer))) (and (not (string-equal name "")) (/= (aref name 0) ? ) (if (not (buffer-modified-p buffer)) t ) (kill-buffer buffer))) (setq list (cdr list))))