1
votes

To answer "where did I also use this identifier?" -questions, I run on macOS and the linuxes

dired-maybe-insert-subdir
dired-mark-files-regexp

followed by either of:

dired-do-find-regexp
dired-do-find-regexp-and-replace

On Windows I can get by using Emacs as my IDE without Cygwin, except for dired recursive search/replace.

Does Projectile offer commands that will search/replace an identifier recursively without requiring Cygwin?

Does any other package make recursive search/replace possible on Windows without Cygwin?

I'm not concerned about the speed, because even after installing Cygwin, the recursive invocation of Cygwin's grep from within Emacs is painfully slow.

Update:

Recursive search/replace seems to be available in both Helm and Projectile.

If true, then my question is:

  1. Is the feature available on Windows without Cygwin?
  2. The list of requires in my .emacs is already excessive. What is a light package that will do recursive search/replace (without Cygwin on Windows)?

Clarification:

OK. Success. [Thanks to Drew] With a .emacs containing nothing but (require 'dired+), I can search-and-replace in marked files using M-+ Q on Windows without having Cygwin installed. I'm guessing that this will also work on linux/macOS, although perhaps not quite as quickly as delegating to grep. (The "Act on ALL files [] in and UNDER this dir?" confirmation message will start to get tedious, but that's a separate question.)

For the present question one issue needs clarification. dired+ augments the built-in dired family of commands. Is there a way for it to take over ordinary dired-do-find-regexp-and-replace? That's because with the one-liner .emacs, and with a few marked files in a directory listing, I get

File not found - GREP
File not found - -I
...
File not found - NUL
File not found - ;

indicating that grep is still being invoked. How can tell dired+ "I'm on Windows and I won't install Cygwin; please take over A and Q?" (mapped by default dired-do-find-regexp and the aforementioned command).

Editorial: dired+ seems a bit overwhelming, but if it solves this one problem (eliminate the need for Cygwin on Windows), it will be well-worth figuring out how to move from the usual dired commands to dired+.

1

1 Answers

0
votes

I think you're looking for a way to search files and get a list of those that match a regexp. If tags-query-replace works for you on MS Windows (without Cygwin), and I think it should, then you can use command diredp-do-query-replace-regexp-recursive, bound to M-+ Q by default, available from Dired+.

That acts on all marked files in the current Dired buffer, and on all marked files in all of the buffer's marked subdirs, and so on, recursively.

With a non-negative prefix arg it acts on all files in the current buffer and all files in all subdirs, and so on, recursively. (That is, any marks are ignored, and the effect is as if everything were marked.)


If, instead of finding files that match a regexp, you want to search through files then you can use command diredp-do-isearch-regexp-recursive, bound to M-+ M-s a C-M- by default, also available from Dired+. The files to access are defined similarly (all Dired+ dired[p]-do...-recursive commands act similarly wrt which files are identified to act on). That definitely does not require any Cygwin etc. commands - it's just Isearch.