Subject: bug#40152: 27.0.90; icomplete vs recursive prompts

From: Kévin Le Gouguec <[email-masked]>
Date: Sun, 24 Jan 2021 16:06:55 +0100

Kévin Le Gouguec <[email-masked]> writes:

> 1. create an ~/.authinfo.gpg file with the EasyPG assistant[1]
> 2. pkill -HUP gpg-agent
> 2. emacs -Q
> 3. (progn
>      (setq epg-pinentry-mode 'loopback)
>      (icomplete-mode))
> 5. C-x C-f /ssh:
>
> This brings up epa.el's "Passphrase for symmetric encryption" prompt to
> unlock ~/.authinfo.gpg.  The prompt cannot be completed, because any
> self-inserting character brings the "Find file" prompt back up, and from
> *there*, typing any character brings the "Passphrase for symmetric
> encryption" prompt back again.

Still getting bitten by this, just about every time I start Emacs and
open a remote file.

I've tried to debug this repeatedly, but I'm obviously doing it wrong
since no amount of debugging-on-entry or tweaking
{pre,post}-command-hook amounted to anything.

FWIW I've dumped backtraces of both the TRAMP recipe and the etags
recipe.

I am mildly intrigued by this comment in icomplete-post-command-hook:

  (defun icomplete-post-command-hook ()
    (let ((non-essential t)) ;E.g. don't prompt for password!
      (icomplete-exhibit)))

As can be seen in the backtraces, prompts are definitely happening while
calling icomplete-exhibit; I have no idea whether this is suspicious, or
if that comment is a red herring…

My hunch is that icomplete sets up *something* that is not cleared and
keeps being triggered when the second prompt shows up; I haven't been
able to pinpoint what yet.

If any completion wizard out here has advice on how to debug this
further, I'm all ears!