Subject: Re: bug#48500: 28.0.50; url-retrieve-synchronously exits abnormally due to pending keyboard input from terminal

From: Eli Zaretskii <[email-masked]>
Date: Tue, 18 May 2021 19:54:03 +0300

> From: Shane Mulligan <[email-masked]>
> Date: Wed, 19 May 2021 04:32:16 +1200
> 
> Thanks for looking into this so quickly. First some background on the problem. I managed to work through
> this issue (https://github.com/emacs-helm/helm/issues/2417) with the `emacs-helm` maintainer and we
> found what appears to be that the call to `accept-process-output` inside of `url-retrieve-synchronously` will
> generate a `C-g` when there is pending input of any char. As far as I can tell this is an issue only with
> terminal emacs. As I understand it, `inhibit-quit`, as used in `accept-process-output` allows a `C-g` to be
> propagated outwards and handled and from what I can see by the comments surrounding,
> 
> ```
>               ;; accept-process-output returned nil, maybe because the process
>               ;; exited (and may have been replaced with another).  If we got
>               ;; a quit, just stop.
> ```
> 
> the `C-g` in this case is expected.
> 
> But I wonder if `C-g` was meant to be generated if the user was simply mashing keys on the keyboard.  In
> this case, the `C-g` emanating from `accept-process-output` was bubbling up into `helm` and `helm` was
> treating it like an error.
> 
> Here, you can see a quit being generated from the visual cue in the minibuffer.
> https://asciinema.org/a/nAIB8Z1lGgZJqJg9Mt8YiNEM9
> 
> Here, I have added `while-no-input` and I no longer get the `quit`.
> https://asciinema.org/a/x9ELZhwDP1IUtmOz0M1cly42H
> 
> However, as I test the addition of `while-no-input` with `helm-google-suggest` (as above), though Quit is no
> longer being generated from mashing keys, the key input which would have generated the `quit` is not
> immediately shown in `helm`. Instead, it only appears on the next key press. So my implementation may not
> be perfect or complete.
> 
> Finding the solution would make the minibuffer far less interrupted while typing when
> `url-retrieve-synchronously` is used in the background.
> 
> Thank you.
> 
> Shane Mulligan

Please in the future send your responses with the bug address,
[email-masked], on the CC list, so that others will see your
detailed descriptions.  I won't have time to take a good look into
that in the next few days, so it's good to make others aware of your
findings, because they might look into it meanwhile.

Personally, I find it very strange that typing on the keyboard
produces C-g, it shouldn't happen, neither on a TTY nor on a GUI
display.