From: "Drew Adams" <drew.adams@oracle.com>
To: <f.braennstroem@gmx.de>, <help-gnu-emacs@gnu.org>
Subject: RE: delete unneeded buffers
Date: Tue, 19 Aug 2008 13:03:03 -0700 [thread overview]
Message-ID: <002701c90236$992a8540$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <g8f004$m4e$1@tamarack.fernuni-hagen.de>
> 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)
next prev parent reply other threads:[~2008-08-19 20:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002701c90236$992a8540$0200a8c0@us.oracle.com' \
--to=drew.adams@oracle.com \
--cc=f.braennstroem@gmx.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).