From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: weber Newsgroups: gmane.emacs.help Subject: Re: delete unneeded buffers Date: Tue, 19 Aug 2008 13:14:57 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1219178497 20649 80.91.229.12 (19 Aug 2008 20:41:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Aug 2008 20:41:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 19 22:42:28 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 1KVY1O-0007oS-Kv for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 22:41:43 +0200 Original-Received: from localhost ([127.0.0.1]:48278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KVY0Q-00037n-W0 for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Aug 2008 16:40:43 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!m36g2000hse.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 77 Original-NNTP-Posting-Host: 189.32.80.34 Original-X-Trace: posting.google.com 1219176897 21080 127.0.0.1 (19 Aug 2008 20:14:57 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 19 Aug 2008 20:14:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m36g2000hse.googlegroups.com; posting-host=189.32.80.34; posting-account=7GrjgQoAAAD6slWURausdJnhFDkmQYC8 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 stargate.datacom:3128 (squid/2.6.STABLE5) Original-Xref: news.stanford.edu gnu.emacs.help:161447 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:56794 Archived-At: On Aug 19, 5:03=A0pm, "Drew Adams" wrote: > > =A0 =A0 does anyone know of a good way to kill unneeded buffers? > > =A0 =A0 I think of something which kills all unvisible dired > > =A0 =A0 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 file= name. > > * 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 buffer= s - > they are the only possible completion candidates: > > (icicle-define-command kill-invisible-dired-buffer > =A0 "Kill invisible Dired buffer(s)." > =A0 kill-buffer "Kill buffer: " > =A0 (mapcar (lambda (b) (list (buffer-name b))) > =A0 =A0 =A0 =A0 =A0 (buffer-list)) > =A0 (lambda (b) > =A0 =A0 (let ((buf (get-buffer (car b)))) > =A0 =A0 =A0 (and (bufferp buf) > =A0 =A0 =A0 =A0 =A0 =A0(not (get-buffer-window buf 'visible)) > =A0 =A0 =A0 =A0 =A0 =A0(with-current-buffer buf > =A0 =A0 =A0 =A0 =A0 =A0 =A0(eq major-mode 'dired-mode))))) > =A0 t) > > Or, better, to be sure *Completions* is updated properly after killing on= e 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 *Comple= tions > 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/Ic= icles_-_Candidate_Sets. > > The real point is that such a command is easy for *you* to define. You ju= st > supply: > > * the command name > > * the action function: what `C-mouse-2' or `C-RET' does to a single candi= date, > and what `C-!' does to each matching candidate > > * the usual arguments to `completing-read': > > =A0 - prompt string > =A0 - collection of possible candidates > =A0 - predicate to filter those candidates > =A0 - flag saying whether input must match (strict vs lax completion) Another option if you are just bothered with a bunch of *name* buffers is to customize emacs so they are hidden. I use ido, so i customize ido-ignore-buffers to achieve that.