Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

emacs

dired

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?

like image 934
polyglot Avatar asked Jul 10 '09 15:07

polyglot


People also ask

How do I open multiple files in Emacs?

Much better to use the multiple buffer feature of emacs. If you are editing the first file and want to start editing the second file, simply use the hot key C-x C-f or the menu selection File->Open File to start the second file. The second file is loaded into its own buffer.

What is the command to searching a file from within Emacs?

To find a file in Emacs, you use the C-x C-f ( find-file ) command.

How do you Dired in Emacs?

In order to invoke Dired in Emacs, all you need to do is type C-x C-f . In the “minibuffer” at the bottom of your Emacs frame, you'll see “Find file:” and a prompt to enter a directory path. Press RET after entering your directory and you will see a listing for that directory. This is where the fun begins.


1 Answers

In Emacs 23.2 and higher, the dired-x.el module is available, and it gives you access to a command that does exactly what you want. After you load it (just (load "dired-x"), normally), you'll be able to invoke the function dired-do-find-marked-files. Here's 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 C-x 2 first. To display just marked files, type C-x 1 first. 

So after dired-x is loaded, you can just use M-x dired-do-find-marked-files RET and you'll get exactly what your question asks for: all marked files will be visited as though you'd run dired-find-file on all of them.

like image 184
xwl Avatar answered Sep 29 '22 01:09

xwl