0

Windows 10, Emacs 26.1.

I need to find all files that content specific text ,e,g. ("hello"). I need to specify:

  1. is case sensitive
  2. is search also in all subfolders
  3. to find by some text and by regexp
  4. The result must show in separate buffer (e.g. Result)
  5. does not depend on the external grep tool

I know about grep tool. But it not very comfortable.

phils
  • 48,657
  • 3
  • 76
  • 115
a_subscriber
  • 3,854
  • 1
  • 17
  • 47
  • did you try ack? https://www.emacswiki.org/emacs/Ack – manandearth Nov 26 '18 at 08:35
  • also there are some specific-windows functions in the bottom of the grep page here: https://www.emacswiki.org/emacs/GrepMode – manandearth Nov 26 '18 at 08:36
  • If you have a Unix-like `find` and `grep` installed and visible to Emacs (and in general it's very sensible to do so), then you can just use `M-x rgrep` – phils Nov 26 '18 at 09:01
  • 1
    To be clear, the **best** tool to find files with content matching some pattern will categorically require an external program. That needn't necessarily be `grep` -- there are alternatives (`ripgrep` is well-regarded) -- but having `grep` installed is *highly* recommended, even if you also install alternatives. Any solution which does not rely on an external tool will not be the **best** possible tool for the job. – phils Nov 26 '18 at 09:50
  • 1
    The question is too broad and unclear. There are many, many ways to do what you ask. You need to specify what you want, not just say that you don't want `grep`. Your question might be more appropriate for a discussion site such as Reddit. – Drew Nov 26 '18 at 15:29
  • "More comfortable" isn't a precise description. Can you elaborate? –  Nov 26 '18 at 18:43
  • I found external package for find/replace files by content and extensions in folder and subfolders - "xah-find" - http://ergoemacs.org/emacs/elisp-xah-find-text.html . It's not depend from external tool like grep/find. It's create on pure Elisp. – a_subscriber Nov 28 '18 at 08:48

1 Answers1

1

You can try elgrep. The github version linked here already has already an option for case sensitivity. Within a day or so that version should also be available via list-packages from melpa.

Some features:

  • Menu for specifying search strings and search options with history and M-tab completion.
  • elgrep does not depend on the external grep tool
  • asynchronous recursive search (optionally with limits for the search depth)
  • Specify directories and files to be searched by regular expressions.
  • Choose how many context lines around matches are shown.
  • Extra results buffer as for find-grep.
  • Editable results buffer. It is possible to write the edited results back to the matching files.
  • .pdf-files are also searched for matches with the help of the external tool pdftotext. (Make sure that pdftotext is in the PATH if you want to use that feature.)
  • The search function can be specified. You can replace re-search-forward by search-forward to search for text instead of regular expressions.

Screenshot of the menu:

elgrep-menu

Tobias
  • 32,569
  • 1
  • 34
  • 75