I need some script that will find and open files by given开发者_如何学JAVA pattern within current directory and it's subdirectories, kind of Snap Open for GEdit, fuzzyfinder for VIM and TextMate's Open Files.
any ideas?
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.
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.
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]
.
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
.
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.
You may try ido mode. Read following for more options.
ido on emacswiki
精彩评论