2

When I use Emacs on a Linux OS, I search through files with rgrep. On Windows machine this takes some additional setup. Is there an Emacs-powered solution for searching through multiple files that does not depend on external utilities?

Matthew Piziak
  • 5,958
  • 3
  • 29
  • 77
  • 3
    That would be really, really slow... There would be no way around creating at least a temporary buffer and reading all of it. Anywhat scalable solution would require an external program. I mean, this is doable, but you won't like it :) – wvxvw Feb 09 '15 at 16:35
  • That's a good point. Org agenda certainly takes a long time to generate, and most of that is just reading files into buffers. – Matthew Piziak Feb 09 '15 at 17:06
  • 1
    If the buffers that you want to search in are already open, `multi-occur` can help you. Here's a little blog post by Mickey Peterson on [Searching in Buffers with Occur Mode](http://www.masteringemacs.org/article/searching-buffers-occur-mode). – Kaushal Modi Feb 10 '15 at 22:14
  • Do the additional set-up to get a real grep binary (and other 'standard' external tools). Just consider it a standard part of installing Emacs on Windows. – phils Feb 10 '15 at 22:51
  • @phils, I generally do. Sometimes I feel like I'm installing system calls to a *de facto* Emacs operating system. All the same, I'm curious of the alternatives, and in some constrained situations a native solution may come in handy. – Matthew Piziak Feb 10 '15 at 23:14

2 Answers2

4

ernie is a 100% Emacs Lisp script that can be used as a drop-in replacement for grep making it easy to grep using the native version of Emacs on Windows

I have not tried it, but there you go.

Brian Z
  • 2,863
  • 16
  • 22
3

Eshell contains a grep implementation in em-unix.el known as eshell-poor-mans-grep. As the name indicates, you shouldn't be using this since it's slow and eats lots of memory to get the job done. But considering you don't want to use anything external, why not give this internal tool a try...

wasamasa
  • 21,803
  • 1
  • 65
  • 97