[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove all directory listings buffers

From: Colin S. Miller
Subject: Re: Remove all directory listings buffers
Date: Wed, 25 Nov 2009 14:23:03 +0000
User-agent: Mozilla-Thunderbird (X11/20090706)

rotlas wrote:
I often end up with lots of directory buffers (those buffers with "dired by
name" mode), after navigating in the filesystem in order to open files. Is
there an easy way to get rid of all those buffers at once, and leaving the


if you use ibuffer instead of buffer then this will work
C-x b            (show the list of buffers)
//               (remove filtering)
/b               (filter by buffer)
C-home C-k       (remove default option)
dired-mode RET   (show only the dired buffers)
move the cursor to the [buffers] list
d                (select all for deleting)
x                (delete all marked buffers)

that is a bit of a hassle, so this bit of list will

(require 'cl)
(defun kill-dired-buffers ()
  "Kills all buffers in dired-mode"
    (let ((buf))
    (loop for buf in (buffer-list)
      do (progn
          (set-buffer buf)
            (if (eq major-mode 'dired-mode)
                (kill-buffer buf)))))))

note that this doesn't kill the split-window associated with the dired-buffer.

Colin S. Miller

Replace the obvious in my email address with the first three letters of the 
hostname to reply.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]