* delete unneeded buffers
@ 2008-08-19 17:30 Fabian Braennstroem
2008-08-19 18:58 ` Colin S. Miller
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Fabian Braennstroem @ 2008-08-19 17:30 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
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.
Greetings!
Fabian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: delete unneeded buffers
2008-08-19 17:30 delete unneeded buffers Fabian Braennstroem
@ 2008-08-19 18:58 ` Colin S. Miller
2008-08-19 20:03 ` Drew Adams
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Colin S. Miller @ 2008-08-19 18:58 UTC (permalink / raw)
To: help-gnu-emacs
Fabian Braennstroem wrote:
> Hi,
>
> 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.
>
> Greetings!
> Fabian
Fabian,
If you use ibuffer instead of buffer (normally on C-x b) you can do this.
To try out ibuffer, use M-x ibuffer-list-buffers.
To replace buffer with ibuffer, place in your
init.el
(require 'ibuffer)
(global-set-key [(control x) (control b)] 'ibuffer-list-buffers)
Once in *Ibuffer*
press
/ m RET dired-mode RET
to list only the dired buffers,
move the cursor to [Default],
then press
d x
to select and delete all dired buffers,
then press
/ /
to list all buffers again.
You can also use
s v
to sort by last view time, and
s m
to sort by major-mode.
HTH,
Colin S. Miller
--
Replace the obvious in my email address with the first three letters of the hostname to reply.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: delete unneeded buffers
2008-08-19 17:30 delete unneeded buffers Fabian Braennstroem
2008-08-19 18:58 ` Colin S. Miller
@ 2008-08-19 20:03 ` Drew Adams
2008-08-20 1:02 ` Drew Adams
[not found] ` <mailman.17073.1219176206.18990.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2008-08-19 20:03 UTC (permalink / raw)
To: f.braennstroem, help-gnu-emacs
> 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)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: delete unneeded buffers
[not found] ` <mailman.17073.1219176206.18990.help-gnu-emacs@gnu.org>
@ 2008-08-19 20:14 ` weber
0 siblings, 0 replies; 7+ messages in thread
From: weber @ 2008-08-19 20:14 UTC (permalink / raw)
To: help-gnu-emacs
On Aug 19, 5:03 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > 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)
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: delete unneeded buffers
2008-08-19 20:03 ` Drew Adams
@ 2008-08-20 1:02 ` Drew Adams
0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2008-08-20 1:02 UTC (permalink / raw)
To: f.braennstroem, help-gnu-emacs
I said:
> 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
I should have also mentioned that whenever you use an Icicles multi-command,
such as `icicle-buffer' (`C-x b', by default), that asks for buffer-name
completion, you can use `S-delete' to kill individual buffers on the fly. And
you can use `C-u S-delete' to kill all that match your current input, after
confirmation.
`S-delete' also works this way for other kinds of objects during completion. For
`icicle-find-file' (`C-x C-f', by default), for instance, you can use `S-delete'
to delete individual files or `C-u S-delete' to delete all that match your
current input.
http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_More_About_Multi-Commands
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: delete unneeded buffers
2008-08-19 17:30 delete unneeded buffers Fabian Braennstroem
` (2 preceding siblings ...)
[not found] ` <mailman.17073.1219176206.18990.help-gnu-emacs@gnu.org>
@ 2008-08-20 9:50 ` Nikolaj Schumacher
2008-08-21 4:51 ` Fabian Braennstroem
4 siblings, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2008-08-20 9:50 UTC (permalink / raw)
To: f.braennstroem; +Cc: help-gnu-emacs
Fabian Braennstroem <f.braennstroem@gmx.de> wrote:
> 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.
`clean-buffer-list' might help you out. It comes with `midnight-mode',
which can also call it periodically.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: delete unneeded buffers
2008-08-19 17:30 delete unneeded buffers Fabian Braennstroem
` (3 preceding siblings ...)
2008-08-20 9:50 ` Nikolaj Schumacher
@ 2008-08-21 4:51 ` Fabian Braennstroem
4 siblings, 0 replies; 7+ messages in thread
From: Fabian Braennstroem @ 2008-08-21 4:51 UTC (permalink / raw)
To: help-gnu-emacs
Hi to all,
thanks a lot! I will try to use icicles like Drew
suggested. The way using ibuffer is not so 'quick', at
least I am using it for a while and rarely use it...
Thanks!
Fabian
* Fabian Braennstroem <f.braennstroem@gmx.de> wrote:
> Hi,
>
> 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.
>
> Greetings!
> Fabian
Greetings!
Fabian
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-08-21 4:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 17:30 delete unneeded buffers Fabian Braennstroem
2008-08-19 18:58 ` Colin S. Miller
2008-08-19 20:03 ` Drew Adams
2008-08-20 1:02 ` Drew Adams
[not found] ` <mailman.17073.1219176206.18990.help-gnu-emacs@gnu.org>
2008-08-19 20:14 ` weber
2008-08-20 9:50 ` Nikolaj Schumacher
2008-08-21 4:51 ` Fabian Braennstroem
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).