Subject: bug#38024: 27.0.50; icomplete sometimes fails to show completions after backward-killing words

From: Stefan Monnier <[email-masked]>
Date: Mon, 05 Apr 2021 16:59:32 -0400

[ Resending, as usual, since the bug was archived.  Sorry.  ]

João Távora [2019-11-02 11:12:07] wrote:
> Eli Zaretskii <[email-masked]> writes:
>>   In end of data:
>>   icomplete.el:669:1:Warning: the function `while-no-input-ignore-events' is not
>>       known to be defined.
>> while-no-input-ignore-events is not a function, it's a variable.
> Sorry,
> This was a merge blunder when reordering commits. The reference appears
> again in the corrct variable form below.  I've now fixed the problem in
> 6911ef3da69333cb7adc1a7fb0a0fc001220a0c4.

Hmm... so the patch installed was basically:

    commit 88f193ed05649b8c622867b8b2623b8cb08fdc96
    Author: João Távora <[email-masked]>
    Date:   Sat Nov 2 02:29:56 2019 +0000
    
        Improve fix for icomplete's backward-kill-word bug#38024
        
        * lisp/icomplete.el (icomplete-exhibit): Use
        while-no-input-ignore-events, not redisplay.
        
        Co-authored-by: Stefan Monnier <[email-masked]>
    
    diff --git a/lisp/icomplete.el b/lisp/icomplete.el
    index 02eae55a19..89318ca4c7 100644
    --- a/lisp/icomplete.el
    +++ b/lisp/icomplete.el
    @@ -399,8 +399,6 @@ icomplete-exhibit
     See `icomplete-mode' and `minibuffer-setup-hook'."
       (when (and icomplete-mode
                  (icomplete-simple-completing-p)) ;Shouldn't be necessary.
    -    (redisplay)     ; FIXME: why is this sometimes needed when moving
    -                    ; up dirs in a file-finding table?
         (save-excursion
           (goto-char (point-max))
                                             ; Insert the match-status information:
    @@ -420,6 +418,11 @@ icomplete-exhibit
                    ;; embarking on computing completions:
                    (sit-for icomplete-compute-delay)))
              (let* ((field-string (icomplete--field-string))
    +                 ;; Not sure why, but such requests seem to come
    +                 ;; every once in a while.  It's not fully
    +                 ;; deterministic but `C-x C-f M-DEL M-DEL ...'
    +                 ;; seems to trigger it fairly often!
    +                 (while-no-input-ignore-events '(selection-request))
                      (text (while-no-input
                              (icomplete-completions
                               field-string

but I don't understand why that would help and/or be needed:
`selection-request` is (and has been for many years) in the default
value of `while-no-input-ignore-events` (as set in `subr.el`), so what
this patch ends up doing is forcing `while-no-input` to exit with value
t in more cases (i.e. whenever one of the events in (focus-in focus-out
help-echo iconify-frame make-frame-visible) comes in) rather than
the opposite.

What am I missing?

        Stefan