Oleg Pavliv
Oleg Pavliv

Reputation: 21192

Open some directories recursively in Dired

I want to show a directory in Dired with some sub-directories opened recursively (as if I passed "R" option for them). Is it possible to do this in Emacs? Any ideas how to implement this easily in Elisp?

In windows explorer I would press '*' in folders window to open a directory recursively (of course only sub-directories are visible, not files). I want the same thing in Emacs, but that files are visible too.

Upvotes: 9

Views: 1537

Answers (2)

Dave L.
Dave L.

Reputation: 11239

Prefix dired-maybe-insert-subdir command (bound to i in dired-mode) with C-u to add recursive -R option for ls to insert directory recursively.

C-u i .. R .. <RET>

Upvotes: 14

moltonel
moltonel

Reputation: 1

Played with the idea a bit, and here's my solution, cleaner output and simpler usage. Put in your .emacs. Edit filter (man find) to suit your needs.

(defun find-dired-project (dir)
  (interactive "D")
  (find-dired dir "-not -path '*/.svn*' -not -path '*/.git*' -and -not -path '*.o' -and -type f"))
(global-set-key "\C-xd" 'find-dired-project)

Upvotes: 0

Related Questions