Scenario: I want to detect all
defcustom sexp that have a
:initialize keyword in all Emacs Lisp files inside a directory tree.
Searching for newline can be problematic depending of the regexp engine and the tool that uses it. Despite the following, I did not find something that works for several files:
[^\0]when back references and look-around are allowed. Unfortunately tools like deadgrep do not support them.
C-q C-jis another way but again several tools will not accept multiline regexp.
- I have been able to use
"defcustom [[:ascii:]]+:\(\(type\)\|\(initialize\)\)"with re-builder to validate that this works inside one file. It won't match text that includes non-ASCII characters, but that's probably OK. I guess I could write code that iterate across all files and use that expression or something like that.
I would like to find an Emacs-based tool that would allow me to write a regexp that support identifying text spread across multiple lines and search for that in all files inside a directory tree without having to write my own. Does such an Emacs-based tool exist?