help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] Searching on Windows (find, grep, and indexed search)


From: Lennart Borgman (gmail)
Subject: Re: [h-e-w] Searching on Windows (find, grep, and indexed search)
Date: Fri, 28 Sep 2007 23:28:09 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

Scott Jaderholm wrote:
Hi Emacs users,

First of all, thanks to everyone who's helped to make EmacsW32 a very
nice distribution.

I'm looking for a simple, interactive way to do four basic types of
searches from within Emacs on Windows.

You can do this just as you do it when you use Emacs on GNU/Linux since EmacsW32 comes with the needed programs (from Gnuwin32).

Search:
1 - directory for file named "string"

Just to answer you I tried it (I am actually not using find-dired myself):

  M-x find-dired
  Run find in directory: YOUR-DIR
  Run find (with args): -name YOUR-FILE

It worked for me - so I learned something ;-)

2 - directory for file containing "string"

Try lgrep or rgrep:

  M-x lgrep
  Search for (default "bla"): YOUR-STRING

I use this very often.

3 - file for lines containing "string"

   M-x occur

4 - and replace all occurrences of "string" in files in directory

There is a lot of way to do it. Without installing any additional packages you can use find-dired (or find-name-dired) to get a dired buffer. In that buffer you can mark all the files with 'm' files you want to replace in and then use 'Q' to start a search and replace.

For other alternatives see

 http://www.emacswiki.org/cgi-bin/emacs-en?CategorySearchAndReplace

From the results buffer I would like to be able to press a keystroke
and go directly to the file and in #2 and #3 go to the line. Showing
file details in #1 would be nice.

I think that find-dired will do #1, but I get a long list of file not
found errors on what appear to be parameters. I think it is
find-ls-option that I need to set but I don't know what to set it to.

I did not change find-ls-option.

I notice that EmacsW32 comes with find and grep in C:\Program
Files\Emacs\EmacsW32\gnuwin32\bin. Do I just need to add that
directory to my path or do I also need to change some variables?

They are already in the path that Emacs uses internally.

I'm running Emacs 22.0.95.1.

I also think find-grep-dired will do #2, but again I get a bunch of
file not found errors on parameters.

How can #3 be done without opening the file first?

You can use

   M-x lgrep

and give the exact file name.

#4 can probably be done with dired, but it probably requires working
find and grep like the above. If there's a better way than dired to do
this I'd love to know.

Additionally, has anyone been able to link search in Emacs into some
cached local search engine like Windows search index?

Thanks,
Scott





reply via email to

[Prev in Thread] Current Thread [Next in Thread]