Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening multiple files at once in Emacs

Tags:

In Emacs using ido-mode allows me to open a file from the minibuffer with C-xC-f. This method opens only one file at a time.

How do I open all the files in a directory or specify more than one file to open?

like image 482
hekevintran Avatar asked Mar 10 '10 02:03

hekevintran


2 Answers

You can just provide * as the file name and press Enter; you'll be asked for a confirmation and if you press Enter a second time, all files in the directory will be opened.

Note that "opening all files in a directory" involves opening dired buffers for all of its subdirectories.

When not using ido-mode -- at the basic Emacs find-file prompt -- you can use the same * to open all files in a directory. When you do use ido-mode to find files, you can always press C-f to drop back to the usual Emacs find-file prompt. (You can use ido to speed up getting to some directory you're interested in first and drop to the basic find-file in there.) That's one way of creating a new file with ido (the other being the C-j binding); also, it gives you another way of using the above mentioned * trick.

like image 136
Michał Marczyk Avatar answered Sep 23 '22 17:09

Michał Marczyk


File-name groking is nowhere near as useful as more general pattern-matching.

In Icicles file-name completion, you can open any number of files matching any number of patterns, from the same minibuffer. Pattern-matching can be substring, regexp, fuzzy, or prefix, and you can combine patterns using intersection and complementing.

Just as in Ido, in Icicles your minibuffer input dynamically filters the file-name candidates. You can choose individual candidates or choose all that currently match (using C-!).

(You can of course use file-name groking also. As with Emacs file-name input generally, hitting RET on a wildcard (grok) pattern sends it to find-file, which opens all matching files.)

like image 28
Drew Avatar answered Sep 21 '22 17:09

Drew