In Emacs dired, how to find / visit multiple files?

If I have several marked files, how can I find / visit all these marked files in emacs, besides running dired-find-file for each of them?

Is there a built-in command or do I need additional lisp code?

+31
emacs dired
Jul 10 '09 at 15:12
source share
3 answers

If you add this to your .emacs, you can open the files using the keyword "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 simply override the built-in 'f' if you want.

+19
Jul 10 '09 at 16:06
source share

The dired-x.el module is available in Emacs 23.2 and later, and it gives you access to a command that does exactly what you want. After loading it (just (load "dired-x") , usually) you can call the dired-do-find-marked-files function. Here is its built-in documentation:

 (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 Cx 2 first. To display just marked files, type Cx 1 first. 

So, after loading dired-x you can simply use Mx dired-do-find-marked-files RET , and you will get exactly what your question asks: all marked files will be visited as if you were running dired-find-file on all of them.

+28
Sep 15 '10 at 6:58
source share

You can try dired + , which provides many extensions for firmware, including the ability to select multiple files and search / browse all of them.

+6
Jul 11 '09 at 4:14
source share



All Articles