From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: delete unneeded buffers Date: Tue, 19 Aug 2008 13:03:03 -0700 Message-ID: <002701c90236$992a8540$0200a8c0@us.oracle.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1219176237 11778 80.91.229.12 (19 Aug 2008 20:03:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Aug 2008 20:03:57 +0000 (UTC) To: , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 19 22:04:48 2008 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 1KVXRc-0000Uk-W9 for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 22:04:45 +0200 Original-Received: from localhost ([127.0.0.1]:40365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVXQe-0003Kx-HK for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 16:03:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KVXQL-0003Im-RC for help-gnu-emacs@gnu.org; Tue, 19 Aug 2008 16:03:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KVXQG-0003Ch-SD for help-gnu-emacs@gnu.org; Tue, 19 Aug 2008 16:03:25 -0400 Original-Received: from [199.232.76.173] (port=55873 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVXQG-0003CP-HG for help-gnu-emacs@gnu.org; Tue, 19 Aug 2008 16:03:20 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]:33931) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KVXQF-0000d1-IH for help-gnu-emacs@gnu.org; Tue, 19 Aug 2008 16:03:20 -0400 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id m7JK37d6013330; Tue, 19 Aug 2008 15:03:07 -0500 Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m7JFKucS027578; Tue, 19 Aug 2008 14:03:02 -0600 Original-Received: from inet-141-146-46-1.oracle.com by acsmt353.oracle.com with ESMTP id 11574344451219176145; Tue, 19 Aug 2008 13:02:25 -0700 Original-Received: from dradamslap1 (/141.144.102.127) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 19 Aug 2008 13:02:25 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AckCLAHf0gCPwRt+QwmPLbAICWCRNwAAGzng In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:56793 Archived-At: > does anyone know of a good way to kill unneeded buffers? > I think of something which kills all unvisible dired > buffers. Would be nice, if anyone has a suggestion. Some possibilities: * `C-x C-b', then mark the buffers you want to delete, then `x'. * Use `ibuffer', then mark buffers by regexp or in other ways, then `x'. You can mark by matching a regexp against buffer name, mode (e.g. Dired), or filename. * In Icicles, `C-x k', then filter buffers (e.g. by regexp), then `C-!' (act on all). * Define your own Icicles multi-command that kills invisible Dired buffers - they are the only possible completion candidates: (icicle-define-command kill-invisible-dired-buffer "Kill invisible Dired buffer(s)." kill-buffer "Kill buffer: " (mapcar (lambda (b) (list (buffer-name b))) (buffer-list)) (lambda (b) (let ((buf (get-buffer (car b)))) (and (bufferp buf) (not (get-buffer-window buf 'visible)) (with-current-buffer buf (eq major-mode 'dired-mode))))) t) Or, better, to be sure *Completions* is updated properly after killing one or more buffers, use this in the definition, in place of `kill-buffer': (lambda (b) (kill-buffer b) (icicle-complete-again-update)) With this command, completion candidates are the invisible Dired buffers. Your minibuffer input at the prompt matches some of the buffers - it can be a regexp. (Empty input matches all candidates.) Use `C-!' to kill all buffers that match. Or click `C-mouse-2' in *Completions to kill individual buffers (or cycle with the arrow keys and use `C-RET'). You can also select a bunch of candidates with the mouse and then act on them. There are lots of possibilities - http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Candidate_Sets. The real point is that such a command is easy for *you* to define. You just supply: * the command name * the action function: what `C-mouse-2' or `C-RET' does to a single candidate, and what `C-!' does to each matching candidate * the usual arguments to `completing-read': - prompt string - collection of possible candidates - predicate to filter those candidates - flag saying whether input must match (strict vs lax completion)