tags:

views:

594

answers:

3

If I have multiple files marked, how do I find/visit all those marked files in emacs, beside running dired-find-file on each of them?

Is there a build-in command, or do I need some extra lisp code?

+6  A: 

If you add this to your .emacs, you'll be able to open the files via the keybinding 'F'.

(eval-after-load "dired"
  '(progn
     (define-key dired-mode-map "F" 'my-dired-find-file)
     (defun my-dired-find-file (&optional arg)
       "Open each of the marked files, or the file under the point, or when prefix arg, the next N files "
       (interactive "P")
       (let* ((fn-list (dired-get-marked-files nil arg)))
         (mapc 'find-file fn-list)))))

Obviously you can just override the built-in 'f' if you want.

Trey Jackson
+2  A: 

You could try dired+ which provides many extensions to dired including the ability to select multiple files and find/view all of them.

luapyad
+1  A: 

There is this builtin command: (on 23.2)

dired-do-find-marked-files is an interactive compiled Lisp function in `dired-x.el'.

(dired-do-find-marked-files &optional NOSELECT)

Find all marked files displaying all of them simultaneously. With optional NOSELECT just find files but do not select them.

The current window is split across all files marked, as evenly as possible. Remaining lines go to bottom-most window. The number of files that can be displayed this way is restricted by the height of the current window and `window-min-height'.

To keep dired buffer displayed, type C-x 2 first. To display just marked files, type C-x 1 first.

[back]

xwl