From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stuart D. Herring" Newsgroups: gmane.emacs.devel Subject: Re: undo-kill-buffer Date: Wed, 25 Oct 2006 07:37:14 -0700 (PDT) Message-ID: <33359.128.165.123.18.1161787034.squirrel@webmail.lanl.gov> References: <200610240856.57965.amax@redsymbol.net> <200610241651.45400.amax@redsymbol.net> <200610241722.09016.amax@redsymbol.net> Reply-To: herring@lanl.gov NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1161787082 6735 80.91.229.2 (25 Oct 2006 14:38:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Oct 2006 14:38:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 25 16:37:57 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Gcjsv-0004MX-RC for ged-emacs-devel@m.gmane.org; Wed, 25 Oct 2006 16:37:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gcjsu-00021m-Kd for ged-emacs-devel@m.gmane.org; Wed, 25 Oct 2006 10:37:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gcjsg-00021P-HE for emacs-devel@gnu.org; Wed, 25 Oct 2006 10:37:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gcjsb-00021A-Ba for emacs-devel@gnu.org; Wed, 25 Oct 2006 10:37:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gcjsb-000216-8l for emacs-devel@gnu.org; Wed, 25 Oct 2006 10:37:17 -0400 Original-Received: from [192.65.95.54] (helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gcjsa-0004AY-QO for emacs-devel@gnu.org; Wed, 25 Oct 2006 10:37:17 -0400 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by mailwasher-b.lanl.gov (8.13.8/8.13.8/(ccn-5)) with ESMTP id k9PEbESp003521 for ; Wed, 25 Oct 2006 08:37:15 -0600 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (8.13.8/8.13.8/(ccn-5)) with ESMTP id k9PEbEEg001207; Wed, 25 Oct 2006 08:37:14 -0600 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id k9PEbEa5030771; Wed, 25 Oct 2006 08:37:14 -0600 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id k9PEbEUJ030769; Wed, 25 Oct 2006 07:37:14 -0700 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.18 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Wed, 25 Oct 2006 07:37:14 -0700 (PDT) In-Reply-To: <200610241722.09016.amax@redsymbol.net> Original-To: "Aaron Maxwell" User-Agent: SquirrelMail/1.4.6-7.el3.7lanl X-Priority: 3 (Normal) Importance: Normal X-PMX-Version: 4.7.1.128075 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:61154 Archived-At: > Yes, i use C-x k . Mostly it happens when I am doing some development > that > happens to involve a large number of files. Often then I will try to kill > buffers I'm no longer working with, just to help keep organized or other > reasons. Sometimes I'll kill a buffer (file) in this way and a moment > later > realize that there is another change I need to make. I use this when I'm "done with a project": (defun kill-buffers-by-regexp (REG &optional AUTO) "Offer to kill each buffer whose name matches REG. If AUTO is non-nil, kill all such buffers, prompting only if a buffer needs saving." (interactive "MRegexp: \nP") (let (to-kill (checker (buffer-list))) (while checker (when (string-match REG (buffer-name (car checker))) (if AUTO (kill-buffer (car checker))) (push (car checker) to-kill)) (setq checker (cdr checker))) (if to-kill (unless AUTO (kill-some-buffers to-kill)) (error "No matches")))) It would obviously be trivial to modify it to match on the filename (including directories, perhaps) rather than the buffer name. If you really want to be able to see the buffers, another trivial modification would be to switch to each buffer before killing it (at least in the AUTO case). The important thing is to avoid the repetitive C-x k RET C-x k RET C-x k RET ... that eventually gets you focusing so much on the keys and so little on the files that you can kill something you'd rather not. Otherwise, when I want to be rid of a buffer for now but don't know that I won't need it again, I use `bury-buffer', which I bind to C-x C-0. (That key doesn't exist on terminals, if it matters.) I find the dabbrev commands to be particularly useful when I have many relevant files in buffers, even if I'm not expecting to modify them. Hope this helps, Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.