all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: undo-kill-buffer
Date: Wed, 25 Oct 2006 09:05:08 -0700	[thread overview]
Message-ID: <EIENLHALHGIMHGDOLMIMIECICMAA.drew.adams@oracle.com> (raw)
In-Reply-To: <33359.128.165.123.18.1161787034.squirrel@webmail.lanl.gov>

    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." ...)

Along similar lines, with Icicles you can do that easily:

1. Type a regexp to the `C-x k' prompt for a buffer name.
2. Hit `S-TAB' to show all buffers that match, in *Completions*.
3. Pick matching buffers to kill - several ways:

   a. `C-!' to kill all matching buffers.
   b. `C-mouse-2' in *Completions* to kill buffers by clicking
      - kill any number of them.
   c. Cycle among the matching buffers with `next' and `prior',
      and use `C-RET' to kill selected candidates during
      cycling - kill any number of them.
   d. Use `C-next' and `C-prior' to kill selected buffer
      and cycle to the next - kill any number of them.

IOW, `C-x k' is a multi-command: you can kill multiple matching buffers in
the same invocation of `C-x k'. You can change the regexp on the fly to
continue killing buffers with names that match a different pattern.
*Completions* is updated as you type in the minibuffer, so it tracks your
input with the names that match.

The exact same thing applies to files and directories, using command
`icicle-delete-file' instead of `C-x k' (`icicle-kill-buffer').

And the same thing applies to windows showing a buffer, using `C-x 0'
(`icicle-delete-window'). With no prefix arg, it just deletes the current
window. With `C-u', it prompts for a buffer name, to delete all windows
showing the buffer. You treat the buffer name using completion, just like
`C-x k', so you can delete all windows showing any selection of buffers, or
all buffers, that match a regexp.

It is easy to define multi-commands like these, BTW. Here is the definition
of `icicle-delete-file':

(icicle-define-file-command
 icicle-delete-file              ; Command name
 "Delete a file or directory."   ; Doc string
 icicle-delete-file-or-directory ; Function to perform action
 "Delete file or directory: "    ; `read-file-name' args
 default-directory nil t)

(defun icicle-delete-file-or-directory (file)
  "Delete file (or directory) FILE."
  (if (eq t (car (file-attributes file)))
      (delete-directory file)
    (delete-file file)))

http://www.emacswiki.org/cgi-bin/wiki/Icicles

  reply	other threads:[~2006-10-25 16:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-24 15:56 undo-kill-buffer Aaron Maxwell
2006-10-24 16:11 ` undo-kill-buffer Stuart D. Herring
2006-10-24 16:46   ` undo-kill-buffer Aaron Maxwell
2006-10-24 16:36 ` undo-kill-buffer Andreas Schwab
2006-10-24 23:43 ` undo-kill-buffer Miles Bader
2006-10-24 23:51   ` undo-kill-buffer Aaron Maxwell
2006-10-25  0:14     ` undo-kill-buffer Stefan Monnier
2006-10-25  0:22       ` undo-kill-buffer Aaron Maxwell
2006-10-25  0:32         ` undo-kill-buffer Stefan Monnier
2006-10-25 14:37         ` undo-kill-buffer Stuart D. Herring
2006-10-25 16:05           ` Drew Adams [this message]
2006-10-25 22:43           ` undo-kill-buffer Miles Bader
2006-10-25 23:02             ` undo-kill-buffer Edward O'Connor
2006-10-25 23:50               ` undo-kill-buffer Miles Bader
2006-10-26  8:53                 ` undo-kill-buffer Richard Stallman
2006-10-25 23:17             ` undo-kill-buffer David Kastrup
2006-10-25 23:46               ` undo-kill-buffer Miles Bader
2006-10-25  0:36       ` undo-kill-buffer Miles Bader
2006-10-25  0:24     ` undo-kill-buffer Miles Bader
2006-10-25  1:11       ` undo-kill-buffer Aaron Maxwell
2006-10-25  0:41 ` undo-kill-buffer Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EIENLHALHGIMHGDOLMIMIECICMAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.