I'm amazed, after 12 years of using Emacs, I still discover new things every week. This week, I learned about M-x occur in a blog post entitled Can your editor do this?.
To use it, go:
M-x occur
And then give it a regexp. I had a buffer with instructions for setting up one of my Ruby on Rails projects, and I wanted to find all the lines that referred to piston, so for the regexp, I typed:
piston
I often use
M-x grep
which is great, it lets you run grep from inside Emacs, and gives you a lot of useful functions, for example, if you press C-c C-c on a line in the grep buffer, Emacs helpfully loads the file for you and jumps to the correct line in the file.
2 comments:
You can also add occur to isearch, as described here: http://www.emacsblog.org/2007/02/27/quick-tip-add-occur-to-isearch/
And with moccur-edit.el you can edit the results in place after occuring on all visited buffers with a filename.
- Phil Jackson
Post a Comment