unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
@ 2022-06-05  1:11 Yilkal Argaw
  2022-06-05  5:45 ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-05  1:11 UTC (permalink / raw)
  To: 55800

using rgrep along with fido-mode or fido-vertical-mode causes the
following error.

-*- mode: grep; default-directory: "~/Documents/src_codes/emacs/" -*-
Grep started at Sun Jun  5 03:59:26

find -H . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o
-path \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o
-path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o
-path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o
-o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name
\*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o
-name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name
\*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name
\*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name
\*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o
-name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name
\*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl
-o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name
\*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name
\*.lo -o -name \*.la -o -name \*.gmo -o -name \*.mo -o -name \*.toc -o
-name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name
\*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o
-name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name
\*.pyc -o -name \*.pyo \) -prune -o  -type f \( -name ./ \) -exec grep
--color=auto -i -nH --null -e something \{\} +
find: warning: ‘-name’ matches against basenames only, but the given
pattern contains a directory separator (‘/’), thus the expression will
evaluate to false all the time.  Did you mean ‘-wholename’?

Grep finished with matches found at Sun Jun  5 03:59:26


The emacs version I tried was: 29.0.50 on x86_64





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-05  1:11 bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors Yilkal Argaw
@ 2022-06-05  5:45 ` Eli Zaretskii
  2022-06-05  7:15   ` Yilkal Argaw
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-06-05  5:45 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800

> From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> Date: Sun, 5 Jun 2022 04:11:02 +0300
> 
> using rgrep along with fido-mode or fido-vertical-mode causes the
> following error.

Could you please show a complete recipe, starting with "emacs -Q" and
listing all the commands needed to reproduce this problem?  That is,
start with "emacs -Q", then invoke the command to use
fido-vertical-mode, then the command to use rgrep with all of its
argument, and anything else that is needed for the error to appear.

Thanks.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-05  5:45 ` Eli Zaretskii
@ 2022-06-05  7:15   ` Yilkal Argaw
  2022-06-05  7:20     ` Yilkal Argaw
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-05  7:15 UTC (permalink / raw)
  To: Eli Zaretskii, 55800

> from:Eli Zaretskii <eliz@gnu.org>
> to:Yilkal Argaw <yilkalargawworkneh@gmail.com>
> cc:55800@debbugs.gnu.org
> date:Jun 5, 2022, 8:45 AM
> Could you please show a complete recipe, starting with "emacs -Q" and
> listing all the commands needed to reproduce this problem?  That is,
> start with "emacs -Q", then invoke the command to use
> fido-vertical-mode, then the command to use rgrep with all of its
> argument, and anything else that is needed for the error to appear.

> Thanks.

My report was made after trying it out in "emacs -q". And here is the
recipe after replicating it inside emacs -q
```
Start emacs with emacs -q
M-x fido-vertical-mode                    ;; fido-mode has the same
effect I tried
M-x rgrep
ethiopic                                           ;; the string to search
.                                                       ;; select
default=all for file type  by simply cliking just press Enter
~/Documents/src_codes/emacs      ;; select the directory to rgrep in
and press Enter

```

I hope this helps in recreating it. I have tested it without fido in
"emacs -q" and it works.
I think it had something to do with.

With Regards

On Sun, Jun 5, 2022 at 8:45 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> > Date: Sun, 5 Jun 2022 04:11:02 +0300
> >
> > using rgrep along with fido-mode or fido-vertical-mode causes the
> > following error.
>
> Could you please show a complete recipe, starting with "emacs -Q" and
> listing all the commands needed to reproduce this problem?  That is,
> start with "emacs -Q", then invoke the command to use
> fido-vertical-mode, then the command to use rgrep with all of its
> argument, and anything else that is needed for the error to appear.
>
> Thanks.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-05  7:15   ` Yilkal Argaw
@ 2022-06-05  7:20     ` Yilkal Argaw
  2022-06-05  9:46       ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-05  7:20 UTC (permalink / raw)
  To: Eli Zaretskii, 55800

> My report was made after trying it out in "emacs -q". And here is the
> recipe after replicating it inside emacs -q
> ```
> Start emacs with emacs -q
> M-x fido-vertical-mode                    ;; fido-mode has the same
> effect I tried
> M-x rgrep
> ethiopic                                           ;; the string to search
> .                                                       ;; select
> default=all for file type  by simply cliking just press Enter
> ~/Documents/src_codes/emacs      ;; select the directory to rgrep in
> and press Enter
>
> ```
>
> I hope this helps in recreating it. I have tested it without fido in
> "emacs -q" and it works.
> I think it had something to do with.
>
> With Regards

sorry the email client just cutted of the line here is the recipe for
better readablity
```
Start emacs with emacs -q
M-x fido-vertical-mode                    ;; fido-mode has the same
effect I tried
M-x rgrep
ethiopic                                           ;; the string to search
.                                                       ;; select
default=all for file type  by simply clicking just press Enter
~/Documents/src_codes/emacs      ;; select the directory to rgrep in
and press Enter

```

On Sun, Jun 5, 2022 at 10:15 AM Yilkal Argaw
<yilkalargawworkneh@gmail.com> wrote:
>
> > from:Eli Zaretskii <eliz@gnu.org>
> > to:Yilkal Argaw <yilkalargawworkneh@gmail.com>
> > cc:55800@debbugs.gnu.org
> > date:Jun 5, 2022, 8:45 AM
> > Could you please show a complete recipe, starting with "emacs -Q" and
> > listing all the commands needed to reproduce this problem?  That is,
> > start with "emacs -Q", then invoke the command to use
> > fido-vertical-mode, then the command to use rgrep with all of its
> > argument, and anything else that is needed for the error to appear.
>
> > Thanks.
>
> My report was made after trying it out in "emacs -q". And here is the
> recipe after replicating it inside emacs -q
> ```
> Start emacs with emacs -q
> M-x fido-vertical-mode                    ;; fido-mode has the same
> effect I tried
> M-x rgrep
> ethiopic                                           ;; the string to search
> .                                                       ;; select
> default=all for file type  by simply cliking just press Enter
> ~/Documents/src_codes/emacs      ;; select the directory to rgrep in
> and press Enter
>
> ```
>
> I hope this helps in recreating it. I have tested it without fido in
> "emacs -q" and it works.
> I think it had something to do with.
>
> With Regards
>
> On Sun, Jun 5, 2022 at 8:45 AM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> > > Date: Sun, 5 Jun 2022 04:11:02 +0300
> > >
> > > using rgrep along with fido-mode or fido-vertical-mode causes the
> > > following error.
> >
> > Could you please show a complete recipe, starting with "emacs -Q" and
> > listing all the commands needed to reproduce this problem?  That is,
> > start with "emacs -Q", then invoke the command to use
> > fido-vertical-mode, then the command to use rgrep with all of its
> > argument, and anything else that is needed for the error to appear.
> >
> > Thanks.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-05  7:20     ` Yilkal Argaw
@ 2022-06-05  9:46       ` Eli Zaretskii
       [not found]         ` <CAJddU=ot4BHXmtW6jFGFniz8KcyPo=_2JLXNK9cQUAPiOFvSTg@mail.gmail.com>
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-06-05  9:46 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800

> From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> Date: Sun, 5 Jun 2022 10:20:20 +0300
> 
> Start emacs with emacs -q
> M-x fido-vertical-mode                    ;; fido-mode has the same
> effect I tried
> M-x rgrep
> ethiopic                                           ;; the string to search
> .                                                       ;; select
> default=all for file type  by simply clicking just press Enter
> ~/Documents/src_codes/emacs      ;; select the directory to rgrep in
> and press Enter

The problem seems to be in grep-read-files, when fido-mode is used:
the prompt says "default all", but fido understands RET as selecting
the currently-highlighted candidate, which happens to be "./" -- and
that, of course, makes no sense as an argument to "-name".





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
       [not found]         ` <CAJddU=ot4BHXmtW6jFGFniz8KcyPo=_2JLXNK9cQUAPiOFvSTg@mail.gmail.com>
@ 2022-06-05 13:02           ` Eli Zaretskii
  2022-06-05 13:25             ` Yilkal Argaw
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2022-06-05 13:02 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800

[Please use Reply All to keep the discussion recorded by the bug tracker.]

> From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> Date: Sun, 5 Jun 2022 15:36:37 +0300
> 
> > from:Eli Zaretskii <eliz@gnu.org>
> > to:Yilkal Argaw <yilkalargawworkneh@gmail.com>
> > cc:55800@debbugs.gnu.org
> > date:Jun 5, 2022, 12:47 PM
> >
> > The problem seems to be in grep-read-files, when fido-mode is used:
> > the prompt says "default all", but fido understands RET as selecting
> > the currently-highlighted candidate, which happens to be "./" -- and
> > that, of course, makes no sense as an argument to "-name".
> 
> Why does the completion even show file names? In counsel-rg  which
> is a command that does similar thing from in the counsel package,the
> second step shows file extension types like c,cpp,el. Can the behaviour
> of the behaviour be modified to show such completion options.

The completion shows file names because the code calls
read-file-name-internal.  Try the same without fido, and at the prompt
for the wildcard type '?' -- you will see a list of files.  That's
what fido shows.

Why that code calls read-file-name-internal, I don't know; perhaps
because it wants to support the use case of searching a single file or
files in a directory?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-05 13:02           ` Eli Zaretskii
@ 2022-06-05 13:25             ` Yilkal Argaw
  2022-06-08  7:19               ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-05 13:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 55800

> The completion shows file names because the code calls
> read-file-name-internal.  Try the same without fido, and at the prompt
> for the wildcard type '?' -- you will see a list of files.  That's
> what fido shows.
>
> Why that code calls read-file-name-internal, I don't know; perhaps
> because it wants to support the use case of searching a single file or
> files in a directory?

I think that is done in the completion option after that where one selects
the file name or a directory based on ones' needs. This option as
I mentioned before  it was supposed to be for file types. If there is no builtin
list for file types(extensions) it might be sufficient to leave it alone
or have it call a list which contains "*" only. I have checked the completion
options for counsel-rg counsel-ag, consult-rg and they do it do it that way

With Regards

On Sun, Jun 5, 2022 at 4:03 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> [Please use Reply All to keep the discussion recorded by the bug tracker.]
>
> > From: Yilkal Argaw <yilkalargawworkneh@gmail.com>
> > Date: Sun, 5 Jun 2022 15:36:37 +0300
> >
> > > from:Eli Zaretskii <eliz@gnu.org>
> > > to:Yilkal Argaw <yilkalargawworkneh@gmail.com>
> > > cc:55800@debbugs.gnu.org
> > > date:Jun 5, 2022, 12:47 PM
> > >
> > > The problem seems to be in grep-read-files, when fido-mode is used:
> > > the prompt says "default all", but fido understands RET as selecting
> > > the currently-highlighted candidate, which happens to be "./" -- and
> > > that, of course, makes no sense as an argument to "-name".
> >
> > Why does the completion even show file names? In counsel-rg  which
> > is a command that does similar thing from in the counsel package,the
> > second step shows file extension types like c,cpp,el. Can the behaviour
> > of the behaviour be modified to show such completion options.
>
> The completion shows file names because the code calls
> read-file-name-internal.  Try the same without fido, and at the prompt
> for the wildcard type '?' -- you will see a list of files.  That's
> what fido shows.
>
> Why that code calls read-file-name-internal, I don't know; perhaps
> because it wants to support the use case of searching a single file or
> files in a directory?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-05 13:25             ` Yilkal Argaw
@ 2022-06-08  7:19               ` Juri Linkov
  2022-06-09 11:11                 ` Yilkal Argaw
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-06-08  7:19 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800, Eli Zaretskii

>> The completion shows file names because the code calls
>> read-file-name-internal.  Try the same without fido, and at the prompt
>> for the wildcard type '?' -- you will see a list of files.  That's
>> what fido shows.
>>
>> Why that code calls read-file-name-internal, I don't know; perhaps
>> because it wants to support the use case of searching a single file or
>> files in a directory?
>
> I think that is done in the completion option after that where one selects
> the file name or a directory based on ones' needs. This option as
> I mentioned before  it was supposed to be for file types. If there is no builtin
> list for file types(extensions) it might be sufficient to leave it alone
> or have it call a list which contains "*" only. I have checked the completion
> options for counsel-rg counsel-ag, consult-rg and they do it do it that way

Did you know that you can use M-j to accept the default value "all"
instead of the highlighted candidate in fido-mode?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-08  7:19               ` Juri Linkov
@ 2022-06-09 11:11                 ` Yilkal Argaw
  2022-06-09 17:09                   ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-09 11:11 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 55800, Eli Zaretskii

> 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. 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.
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.

With Regards
Yilkal A.

On Wed, Jun 8, 2022 at 10:41 AM Juri Linkov <juri@linkov.net> wrote:
>
> >> The completion shows file names because the code calls
> >> read-file-name-internal.  Try the same without fido, and at the prompt
> >> for the wildcard type '?' -- you will see a list of files.  That's
> >> what fido shows.
> >>
> >> Why that code calls read-file-name-internal, I don't know; perhaps
> >> because it wants to support the use case of searching a single file or
> >> files in a directory?
> >
> > I think that is done in the completion option after that where one selects
> > the file name or a directory based on ones' needs. This option as
> > I mentioned before  it was supposed to be for file types. If there is no builtin
> > list for file types(extensions) it might be sufficient to leave it alone
> > or have it call a list which contains "*" only. I have checked the completion
> > options for counsel-rg counsel-ag, consult-rg and they do it do it that way
>
> Did you know that you can use M-j to accept the default value "all"
> instead of the highlighted candidate in fido-mode?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-09 11:11                 ` Yilkal Argaw
@ 2022-06-09 17:09                   ` Juri Linkov
  2022-06-10  3:34                     ` Yilkal Argaw
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-06-09 17:09 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800, Eli Zaretskii

>> 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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-09 17:09                   ` Juri Linkov
@ 2022-06-10  3:34                     ` Yilkal Argaw
  2022-06-10  7:58                       ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-10  3:34 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 55800, Eli Zaretskii

> 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 <juri@linkov.net> 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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-10  3:34                     ` Yilkal Argaw
@ 2022-06-10  7:58                       ` Juri Linkov
  2022-06-12 18:24                         ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-06-10  7:58 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800, Eli Zaretskii

>> 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.

Actually I don't know the intended behaviour of fido-mode, so your
bug report is a valid request to find the source of the problem.
If fido-mode works as intended, then rgrep could be fixed.

> 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.

It looks like your M-x man doesn't find available manual names,
so we need to find a better example.  Here is a plain call
that exposes the problem:

  (completing-read
   (format-prompt "Prompt" "default")
   '("a" "b" "c") nil nil nil nil
   "default")

Without fido-vertical-mode, typing RET returns "default".
With fido-vertical-mode, typing RET returns "a".

So maybe fido-mode could be fixed to always provide the default value
as the first highlighted candidate?  Then RET will select it.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-10  7:58                       ` Juri Linkov
@ 2022-06-12 18:24                         ` Juri Linkov
  2022-06-13  7:20                           ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-06-12 18:24 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800, Eli Zaretskii

>> 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.
>
> Actually I don't know the intended behaviour of fido-mode, so your
> bug report is a valid request to find the source of the problem.
> If fido-mode works as intended, then rgrep could be fixed.

Indeed, part of the problem was in fido-mode.  When the default value
is a string, then the default value is bubbled to the top of the
completion list:

```
(completing-read
 (format-prompt "Prompt" "b")
 '("a1" "b1" "c1") nil nil nil nil
 "b")
```

in fido-vertical-mode displays:
  - b1
  - a1
  - c1

But for a list of default values:

```
(completing-read
 (format-prompt "Prompt" "b")
 '("a1" "b1" "c1") nil nil nil nil
 '("b" "d"))
```

doesn't take into account the first element of the defaults:

  - a1
  - b1
  - c1

So now pushed a better fix than was in bug#38992.

> So maybe fido-mode could be fixed to always provide the default value
> as the first highlighted candidate?  Then RET will select it.

Another part of the problem is still unsolved and the question still is:
shouldn't fido-mode bubble the default value to the top of the list
even when the default value doesn't exist in the list of completion
candidates?  This is the same question as was asked in
https://debbugs.gnu.org/38992#76





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-12 18:24                         ` Juri Linkov
@ 2022-06-13  7:20                           ` Juri Linkov
  2022-06-13 15:13                             ` Yilkal Argaw
  0 siblings, 1 reply; 16+ messages in thread
From: Juri Linkov @ 2022-06-13  7:20 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

>> So maybe fido-mode could be fixed to always provide the default value
>> as the first highlighted candidate?  Then RET will select it.
>
> Another part of the problem is still unsolved and the question still is:
> shouldn't fido-mode bubble the default value to the top of the list
> even when the default value doesn't exist in the list of completion
> candidates?  This is the same question as was asked in
> https://debbugs.gnu.org/38992#76

It seems there is no way to change the behaviour of fido-mode,
so what remains to do is to add the default values to the completion list
only in rgrep, then fido-mode will highlight the default at the top:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: grep-read-files.patch --]
[-- Type: text/x-diff, Size: 1111 bytes --]

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index e0c9e6c76b..5d45a7d88f 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -1072,15 +1072,18 @@ grep-read-files
 	       default-extension
 	       (car grep-files-history)
 	       (car (car grep-files-aliases))))
+	 (defaults
+	   (delete-dups
+	    (delq nil
+		  (append (list default default-alias default-extension)
+			  (mapcar #'car grep-files-aliases)))))
          (files (completing-read
                  (format-prompt "Search for \"%s\" in files matching wildcard"
                                 default regexp)
-		 #'read-file-name-internal
-		 nil nil nil 'grep-files-history
-		 (delete-dups
-		  (delq nil
-                        (append (list default default-alias default-extension)
-				(mapcar #'car grep-files-aliases)))))))
+                 (completion-table-merge
+                  (lambda (_string _pred _action) defaults)
+                  #'read-file-name-internal)
+		 nil nil nil 'grep-files-history defaults)))
     (and files
 	 (or (cdr (assoc files grep-files-aliases))
 	     files))))

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-13  7:20                           ` Juri Linkov
@ 2022-06-13 15:13                             ` Yilkal Argaw
  2022-06-13 17:20                               ` Juri Linkov
  0 siblings, 1 reply; 16+ messages in thread
From: Yilkal Argaw @ 2022-06-13 15:13 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 55800, Eli Zaretskii

Thanks Juri. I think this is much better behaviour.

On Mon, Jun 13, 2022 at 10:43 AM Juri Linkov <juri@linkov.net> wrote:
>
> >> So maybe fido-mode could be fixed to always provide the default value
> >> as the first highlighted candidate?  Then RET will select it.
> >
> > Another part of the problem is still unsolved and the question still is:
> > shouldn't fido-mode bubble the default value to the top of the list
> > even when the default value doesn't exist in the list of completion
> > candidates?  This is the same question as was asked in
> > https://debbugs.gnu.org/38992#76
>
> It seems there is no way to change the behaviour of fido-mode,
> so what remains to do is to add the default values to the completion list
> only in rgrep, then fido-mode will highlight the default at the top:
>





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
  2022-06-13 15:13                             ` Yilkal Argaw
@ 2022-06-13 17:20                               ` Juri Linkov
  0 siblings, 0 replies; 16+ messages in thread
From: Juri Linkov @ 2022-06-13 17:20 UTC (permalink / raw)
  To: Yilkal Argaw; +Cc: 55800, Eli Zaretskii

close 55800 29.0.50
thanks

>> >> So maybe fido-mode could be fixed to always provide the default value
>> >> as the first highlighted candidate?  Then RET will select it.
>> >
>> > Another part of the problem is still unsolved and the question still is:
>> > shouldn't fido-mode bubble the default value to the top of the list
>> > even when the default value doesn't exist in the list of completion
>> > candidates?  This is the same question as was asked in
>> > https://debbugs.gnu.org/38992#76
>>
>> It seems there is no way to change the behaviour of fido-mode,
>> so what remains to do is to add the default values to the completion list
>> only in rgrep, then fido-mode will highlight the default at the top:
>
> Thanks Juri. I think this is much better behaviour.

Thanks for confirming, now the fix was pushed to Emacs 29.





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-06-13 17:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05  1:11 bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors Yilkal Argaw
2022-06-05  5:45 ` Eli Zaretskii
2022-06-05  7:15   ` Yilkal Argaw
2022-06-05  7:20     ` Yilkal Argaw
2022-06-05  9:46       ` Eli Zaretskii
     [not found]         ` <CAJddU=ot4BHXmtW6jFGFniz8KcyPo=_2JLXNK9cQUAPiOFvSTg@mail.gmail.com>
2022-06-05 13:02           ` Eli Zaretskii
2022-06-05 13:25             ` Yilkal Argaw
2022-06-08  7:19               ` Juri Linkov
2022-06-09 11:11                 ` Yilkal Argaw
2022-06-09 17:09                   ` Juri Linkov
2022-06-10  3:34                     ` Yilkal Argaw
2022-06-10  7:58                       ` Juri Linkov
2022-06-12 18:24                         ` Juri Linkov
2022-06-13  7:20                           ` Juri Linkov
2022-06-13 15:13                             ` Yilkal Argaw
2022-06-13 17:20                               ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).