On Wed, Mar 3, 2021 at 1:20 AM Allen Li wrote: > > Some additional context: I'm not asking for find-dired to support -maxdepth necessarily, but the way find-dired is structured makes it impossible to reuse any of the code to write a command that could support -maxdepth. > > I attached a patch pulling most of the find-dired logic into a find-dired-unescaped function so that it can be readily reused. I made a mistake in my initial analysis. find (at least the version I have) allows one to pass global options such as -maxdepth like so: find . \( -maxdepth 3 ARGS \) -ls However, find will print a warning message as this usage is not recommended. Also, I realized that my previous patch, while functional, is awkward since it exists solely to allow users to specify global options (based on the discussion on #27456, I believe all other find functionality should be possible with find-dired). I have made a new patch adding an optional parameter to find-dired for passing such global options to find. Aside: there is a discussion at #32668 about adding a similar command line editing feature like rgrep I'm not fond of that as it is impossible to use programmatically and interacts poorly (read: not at all) with `repeat-complex-command' https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27456