Daniel
Daniel

Reputation: 4314

Snap Open for Emacs?

I need some script that will find and open files by given pattern within current directory and it's subdirectories, kind of Snap Open for GEdit, fuzzyfinder for VIM and TextMate's Open Files.

any ideas?

Upvotes: 2

Views: 639

Answers (6)

Amol Gawai
Amol Gawai

Reputation: 3340

You may try ido mode. Read following for more options.

ido on emacswiki

Upvotes: 0

jrockway
jrockway

Reputation: 42674

You will have to write this one yourself.

I occasionally like to open all relevant files in a project; for this I use eproject's eproject-open-all-project-files command.

Upvotes: 0

justinhj
justinhj

Reputation: 11306

You can do this in standard dired too.

First do

C-u s

which let's you change the dired ls command to -lR. Now you will have subdirectories in the dired buffer.

% m 

Let's you mark all files matching a regexp.

To open the files use the command

`dired-do-find-marked-files'

you need (require 'dired-x) for this one.

Upvotes: 5

danielpoe
danielpoe

Reputation: 3816

doesn't fulfill all your requirements, but one very easy option to open several files is to use glob patterns when you open a file (C-x C-f), like ~/prj/*/*.[hc].

Upvotes: 3

Trey Jackson
Trey Jackson

Reputation: 74430

Not exactly what you're asking for, but close is ifind.el. To find all files that have frog in the name and the suffix .el:

M-x ifind /some/path/*frog*.el

That does do a search through all the subdirectories under /some/path.

It won't open all the files automatically, but instead pops up a *compilation* buffer that allows you to open them up either by clicking on the files or by doing M-x next-error (aka "C-x `").

This routine will open up each of the find results:

(defun visit-all-ifind-results ()
  "do next-error until there are no more"
  (interactive)
  (condition-case nil
      (while t
        (next-error))
    (error nil)))

So, with that, you could just follow up with M-x visit-all-ifind-results.

Upvotes: 1

Don Womick
Don Womick

Reputation: 1118

Not being familiar with any of the referenced libraries, I don't know if this is an exact answer, but it sounds like ido-mode will do at least some of what you're asking for, and it's bundled with Emacs as of version 22. Ido changes the way the default Emacs find-file and find-buffer keybindings work, supplying lists of completions for the strings you type and using the Enter key to accept the current selection (which can be a directory, allowing you to browse the directory structure from the minibuffer). Check the Ido EmacsWiki page for details.

Upvotes: 3

Related Questions