Subject: bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors

From: Yilkal Argaw <[email-masked]>
Date: Fri, 10 Jun 2022 06:34:35 +0300

> Strange, it worked when I tried your test case with fido-vertical-mode.

Sorry about that, the machine I tried that on had M-j assigned to C-m
for some reason using kmonad. I've since removed that config.
So that was my bad.

> This is what it already does: for example, when the current file
> is in Emacs Lisp mode, then the default is: (default *.el)

If this is an intended behaviour that is considered to be intuitive then
sorry about the bug report. I was used to how things like  the rg package
worked and that might have been my fault.

> Surely, rgrep could be changed when necessary.  But is this problem
> really specific to rgrep?  I see exactly the same problem in many
> other commands, e.g.:

> 0. emacs -Q
> 1. M-x fido-vertical-mode RET
> 2. move point to any word
> 3. M-x man RET RET
>
> `man' provides the word under the cursor as the default value.
> But nonetheless RET selects the highlighted candidate instead
> of the default value.

Again it might be my fault but I don't get the "man" example. Doing
all  what you said and using M-x man only presented a single prompt
and that prompt had the word under cursor as the default value. If I
typed nothing the word under cursor(which is displayed in the prompt)
is chosen as the default but if I typed something it searches the man
page for that word. I see no highlighting of candidates there.

But my general thought on the matter was that the list presented to
you on the "files matching wildcard" prompt is a bit confusing whether
you use fido or not. Fido just makes that obvious by presenting that
list to you with the first option highlighted. And in my opinion users
presented with "default=all" in the prompt might not notice the highlighted
text just press RET (i.e. when you are using something like rgrep
you are probably doing something and unlikely to notice the kinks of
the completion list until presented with the error) . So presenting
a completion list that better suits the prompt might be a better option.
Even having that prompt not give any completion candidates might be better
since it will not contain any option that might cause error.But all this
 is my opinion. And if it is a mistake in my usage and if other users
find this the intuitive way to use rgrep then again I'm sorry about
the bug report since it might not be a bug.

On Thu, Jun 9, 2022 at 8:25 PM Juri Linkov <[email-masked]> wrote:
>
> >> Did you know that you can use M-j to accept the default value "all"
> >> instead of the highlighted candidate in fido-mode?
> >
> > M-j did not work.
>
> Strange, it worked when I tried your test case with fido-vertical-mode.
>
> > One could even build a better list of file extensions
> > because asking for "matching wildcards" and providing files
> > instead of file extensions does not quite make sense to a user.
>
> This is what it already does: for example, when the current file
> is in Emacs Lisp mode, then the default is: (default *.el)
>
> > Also I do not think that that is how that function
> > was supposed to behave. Looking into the fille grep.el there is a
> > list called "grep-files-aliases" I think that is the list that should be
> > fed to the completion instead of whatever is generated by
> > read-file-name-internal.
>
> Surely, rgrep could be changed when necessary.  But is this problem
> really specific to rgrep?  I see exactly the same problem in many
> other commands, e.g.:
>
> 0. emacs -Q
> 1. M-x fido-vertical-mode RET
> 2. move point to any word
> 3. M-x man RET RET
>
> `man' provides the word under the cursor as the default value.
> But nonetheless RET selects the highlighted candidate instead
> of the default value.