Subject: bug#46884: [PATCH] 27.1; Cannot run find-dired with -maxdepth

From: Allen Li <[email-masked]>
Date: Wed, 3 Mar 2021 08:22:23 +0000

On Wed, Mar 3, 2021 at 6:28 AM Eli Zaretskii <[email-masked]> wrote:

> > From: Allen Li <[email-masked]>
> > Date: Wed, 3 Mar 2021 03:38:49 +0000
> >
> > -(defun find-dired (dir args)
> > +(defun find-dired (dir args &optional global-args)
> >    "Run `find' and go into Dired mode on a buffer of the output.
> >  The command run (after changing into DIR) is essentially
> >
> > -    find . \\( ARGS \\) -ls
> > +    find . GLOBAL-ARGS \\( ARGS \\) -ls
> >
> >  except that the car of the variable `find-ls-option' specifies what to
> > -use in place of \"-ls\" as the final argument.
> > +use in place of \"-ls\" as the final argument.  GLOBAL-ARGS is empty
> > +when called interactively.
>
> This is okay, IMO, but it would be better to allow the user to specify
> GLOBAL-ARGS interactively if the user invokes the command with a
> prefix argument.
>

 How would that interact with find-args-history?  I could create a separate
history variable, but then it's annoying how the two histories are
separate, as args and global-args together form one query.  I decided to
punt on that issue until someone actually has a use case for providing
global-args interactively.  I would use global-args infrequently enough
that I would rather call find-dired via M-x and iterate on getting the
command right that way, than try to call find-dired interactively
repeatedly with a universal prefix arg and navigating the history for both
the completing-reads for args and global-args separately.  Or I would add
the -maxdepth flag to the args and tolerate the warning in the output.
Actually, my current use case is calling find-dired from Emacs Lisp code
(not interactively) where I want to avoid the warning.