Subject: bug#19031: 24.4; find-file in icomplete-mode shows completions with no input

From: Andrii Kolomoiets <[email-masked]>
Date: Fri, 04 Dec 2020 13:37:17 +0200

Lars Ingebrigtsen <[email-masked]> writes:

> Ole Laursen <[email-masked]> writes:
>
>> Run emacs -Q, evaluate
>>
>>   (icomplete-mode 1)
>>
>> then press C-x C-f and wait a second. There's now completions in the
>> minibuffer despite icomplete-show-matches-on-no-input being nil. Perhaps
>> icomplete is confused by the current working dir being present in C-x
>> C-f.
>
> I think the icomplete-show-matches-on-no-input doc string is just
> unclear here.  It seems like the point of the variable is that you can
> set it to non-nil to force icomplete to wait until we have completions
> before displaying the prompt?  When it's the default nil value, it'll
> still show all the matches, but they may arrive asynchronously.

When the `icomplete-show-matches-on-no-input` variable is nil,
completions will be not shown while minibuffer is empty:

1. emacs -Q
2. M-x icomplete-mode
3. M-x
   => No completions
4. f
   => Completions
5. C-/
   => No completions

With the 'find-file' function, minibuffer already contains the text --
the default directory.  Once the minibuffer will become empty
completions will be hidden:

1. emacs -Q
2. M-x icomplete-mode
3. C-x C-f
   => Completions 
4. C-x h C-w
   => No completions

> I've now clarified this in the doc string in Emacs 28.

Maybe it would be better to replace the text

"When non-nil, show completions when first prompting for input."

with something like

"When non-nil, show completions when minibuffer is empty."