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

From: Allen Li <[email-masked]>
Date: Wed, 03 Mar 2021 20:50:23 -0800

Eli Zaretskii <[email-masked]> writes:
>> From: Allen Li <[email-masked]>
>> 
>>  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?
>
> Sorry, I don't understand the question.  What does prefix arg have to
> do with history?  Maybe I'm missing something.

Currently, `find-dired' stores the `completing-read' history for `args' in
`find-args-history'.  It also stores the value for `args' in `find-args'
to use as the default for the next `find-dired' interactive call.

If we were to make `global-args' accessible interactively, how would the
history for it be stored?  The obvious solution would be to add a
completing-read for `global-args' and create `find-global-args-history'
and `find-global-args' variables to be treated similarly to
`find-args-history' and `find-args' are now.

There are two issues with this.

First, consider what the user would do if they want to repeat a
`find-dired' with `global-args' three calls in the past:

C-u M-x find-dired RET
some/directory RET
M-p M-p M-p RET ; going back three items in the history for args
M-p M-p M-p RET ; going back three items in the history for global-args

This is a poor user experience.

Second, if the user mistakenly omits the C-u, then they might run a
previous command without the global-args that were supplied.

Consider if the user runs find-dired like so:

C-u M-x find-dired RET
some/dir RET
-some -query RET
-maxdepth 3 RET

Then the user wants to repeat the query for another directory:

M-x find-dired RET
other/dir RET
M-p RET ; get previous input, M-p can be omitted since there's a default

Because the user didn't supply the C-u, the "-maxdepth 3" is omitted.
Even though it was the user's intent to repeat the last query, the user
is now running a fundamentally different query.  Again, this is a poor
user experience.