IDE for python

Marko Rauhamaa marko at pacujo.net
Fri May 30 09:54:10 EDT 2014


Rustom Mody <rustompmody at gmail.com>:

>> > 3. Search unopened files (grep) for a string or re.
>
> How do you do this with emacs?
> I find a menagerie of greppish commands -- rgrep, lgrep, grep-find etc

To grep for a pattern in the directory of the active buffer:

   M-x grep
   Run grep (like this): grep -nH -e 

Complete the grep command:

   Run grep (like this): grep -nH -e class *.py

and hit ENTER. Feel free to modify the command from grep to egrep, for
example. I often replace -e with -i.

To grep for a pattern in any subdirectory:

   M-x grep
   Run grep (like this): grep -nH -r assert .

or:

   M-x grep-find
   Run find (like this): find . -type f -exec grep -nH -e assert {} +

Again, you can modify the command freely:

   M-x grep-find
   Run find (like this): find . -name '*.py' -exec grep -nH -e assert {} +

You will get a list of hits in a new buffer. You can use the C-x `
command to traverse them in order, but there are many other ways.


Marko



More information about the Python-list mailing list