From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Shane Mulligan Newsgroups: gmane.emacs.bugs Subject: bug#48500: 28.0.50; url-retrieve-synchronously exits abnormally due to pending keyboard input from terminal Date: Wed, 19 May 2021 18:48:09 +1200 Message-ID: References: <87pmxo4kiu.wl-mullikine@gmail.com> <8335ukrsj3.fsf@gnu.org> <83sg2kq8yc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000005161eb05c2a93684" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15873"; mail-complaints-to="usenet@ciao.gmane.io" To: 48500@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 19 08:49:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljG12-0003uN-QR for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 08:49:13 +0200 Original-Received: from localhost ([::1]:49730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljG11-0001wD-1e for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 May 2021 02:49:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljG0s-0001vh-0Y for bug-gnu-emacs@gnu.org; Wed, 19 May 2021 02:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ljG0r-0003IO-NT for bug-gnu-emacs@gnu.org; Wed, 19 May 2021 02:49:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ljG0r-0002lH-I9 for bug-gnu-emacs@gnu.org; Wed, 19 May 2021 02:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Shane Mulligan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 May 2021 06:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48500 X-GNU-PR-Package: emacs Original-Received: via spool by 48500-submit@debbugs.gnu.org id=B48500.162140690810574 (code B ref 48500); Wed, 19 May 2021 06:49:01 +0000 Original-Received: (at 48500) by debbugs.gnu.org; 19 May 2021 06:48:28 +0000 Original-Received: from localhost ([127.0.0.1]:57817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljG0J-0002kT-Ee for submit@debbugs.gnu.org; Wed, 19 May 2021 02:48:28 -0400 Original-Received: from mail-yb1-f182.google.com ([209.85.219.182]:40820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ljG0H-0002kG-Uu for 48500@debbugs.gnu.org; Wed, 19 May 2021 02:48:26 -0400 Original-Received: by mail-yb1-f182.google.com with SMTP id 191so10761099ybn.7 for <48500@debbugs.gnu.org>; Tue, 18 May 2021 23:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Ox6hTkh1JXUHqpi+tat+MC43CVcQkzXPN0h0YpaQa4A=; b=h3KE4bvgRNH1jZeS5S8VLnY0v5DyG8ieZP7GrZnXJCVovg7E+9ueIUhP8JVXDxRzTa JQ9loQBOwe4VNHWm9DG9J9vbCgf6J3U5OPHfeLGGVCJhCTZWcMfS2SXre44XRLXTxnMr xq5rKLDfQC+JxvIlMhrRL+m97wz03hITMkahIEH7ZOtkmCxaKG+N7m4cPy6opV1Z6F2X n+Dw8kBhfQtay/ZqiVjtN/oHdGA+3pUeedJzEhualV8sv5OjMAZA0js+SvwqtZSiuTH1 zgFWXfwBWBQTxBlzfYVuz2Z/PK3yJ8d5ggg1pcpeOX6dXAKIVdnkC8OV9446ZzhXZrIz G19g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Ox6hTkh1JXUHqpi+tat+MC43CVcQkzXPN0h0YpaQa4A=; b=gsIvZcK3tQHCH4hQtZTE7qcbe5gSZmgIfwp0uka0g20MMmQfXRX2nX78+7SAUO2QjD DcAYBeBsSuZvPnHkl2I1K5M604bf0rpNm5c7FlBmYTDmOBsvGnj4RFquMPfPdzwC2Mfj AtxIa9iIPa6hucvJYBhJOCwJaHYTZwKms9DsAz4Cuhr0fYFL7z+DNf6/LbYR6XTn19It iaqODgFp1o/TmuBuzYTgjjn2xSwKgJDImWVaJ0unvqnoxgAoRLVZ6Kyd3Ph0f2lVvnhF 37eraThy4lXu0GCIUby68sjQxzeHc5IkX80zUtj1bEHnP+Nce8ySzbqDpK4HtudT+M+F 956Q== X-Gm-Message-State: AOAM533NViNTLapXzrOS7lx+YEhPjnN1cbP3BP029qbaJo/TE/gv+twc J/APdEZUyc/aH6WUSdLgzK820Eo4QV2YQKIFv+TgKSrLMqZP X-Google-Smtp-Source: ABdhPJynpzF7B8EgRo87CC7GLVdj+4OWP6yQu6WXA8JPgOJRS1LYcvLylg9Rzp24KVZtHhMd9jvQFkKYryFfs2afHrg= X-Received: by 2002:a25:b108:: with SMTP id g8mr13812045ybj.472.1621406900117; Tue, 18 May 2021 23:48:20 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:206857 Archived-At: --0000000000005161eb05c2a93684 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I may have resolved this issue with the following patch to `url-retrieve-synchronously`. What this achieves is to trigger a `quit` in a controlled environment rather than allowing it to occur when `accept-process-output` is run. It's not always wanted to trigger a quit when `(input-pending-p)` is `t`. But I noticed from placing `while-no-input` around `accept-process-output` to avoid the `quit` that `url-retrieve-synchronously` would then hang but with the controlled `quit` happening beforehand, `accept-process-output` no longer needs `while-no-input` around it. The end result is buttery smooth helm with no accidental `quit` from typing too fast. I think this may have resulted in GUI helm faster too. ``` 29c29,30 < (let ((proc (get-buffer-process asynch-buffer))) --- > (let ((proc (get-buffer-process asynch-buffer)) > (counter 0)) 71a73,78 > (with-local-quit > (if (input-pending-p) > (progn > (setq counter (1+ counter)) > (if (> counter 20) > (keyboard-quit))))) ``` Shane Mulligan How to contact me: =F0=9F=87=A6=F0=9F=87=BA 00 61 421 641 250 =F0=9F=87=B3=F0=9F=87=BF 00 64 21 1462 759 <+64-21-1462-759> mullikine@gmail.com On Wed, May 19, 2021 at 11:32 AM Shane Mulligan wrote= : > My apologies. It was literally 5am when I wrote that. I think I have > misunderstood `C-g` being generated with `quit-flag`. The bad behaviour i= s > very clearly still happening. I will try to clarify this problem further = by > experimenting with it. I need to figure out why `while-no-input` suppress= es > the `quit` but merely setting `quit-flag` does not. Something indirect ma= y > be happening. > > Thank you all, > Shane Mulligan > > How to contact me: > =F0=9F=87=A6=F0=9F=87=BA 00 61 421 641 250 > =F0=9F=87=B3=F0=9F=87=BF 00 64 21 1462 759 <+64-21-1462-759> > mullikine@gmail.com > > > On Wed, May 19, 2021 at 4:54 AM Eli Zaretskii wrote: > >> > From: Shane Mulligan >> > 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 comment= s >> 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, >> 48500@debbugs.gnu.org, 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. >> > --0000000000005161eb05c2a93684 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I may have resolved this issue with = the following patch to `url-retrieve-synchronously`.
What this ac= hieves is to trigger a `quit` in a controlled environment rather than allow= ing it to occur when `accept-process-output` is run.
It's= not always wanted to trigger a quit when `(input-pending-p)` is `t`. But I= noticed from placing `while-no-input` around `accept-process-output` to av= oid the `quit` that `url-retrieve-synchronously` would then hang but with t= he controlled `quit` happening beforehand, `accept-process-output` no longe= r needs `while-no-input` around it. The end result is buttery smooth helm w= ith no accidental `quit` from typing too fast. I think this may have result= ed in GUI helm faster too.

```
29c29,30
&l= t; =C2=A0 =C2=A0 =C2=A0 (let ((proc (get-buffer-process asynch-buffer)))---
> =C2=A0 =C2=A0 =C2=A0 (let ((proc (get-buffer-process asynch-bu= ffer))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (counter 0))
71= a73,78
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-local-quit> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (input-pending-= p)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= progn
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (setq counter (1+ counter))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (> counter 20)
> =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (keyboard-quit)))))
```
S= hane Mulligan

<= /tr>
How to contact me:
3D""<= table>
=F0=9F=87=A6=F0=9F=87=BA00 61 421 641 250
=F0=9F=87= =B3=F0=9F=87=BF00 64 2= 1 1462 759
mullikine@gmail.com



On Wed, May 19, 2021 at 11:32= AM Shane Mulligan <mullikine@gma= il.com> wrote:
My apologies. It was literally 5am when I wrote that= . I think I have misunderstood `C-g` being generated with `quit-flag`. The = bad behaviour is very clearly still happening. I will try to clarify this p= roblem further by experimenting with it. I need to figure out why `while-no= -input` suppresses the `quit` but merely setting `quit-flag` does not. Some= thing indirect may be happening.=C2=A0

Thank you all,
<= div dir=3D"ltr">
Shane Mulligan

How to contact me:
3D""
=F0=9F=87= =A6=F0=9F=87=BA00 61= 421 641 250
=F0=9F=87=B3=F0=9F=87=BF00 64 21 1462 759
= mullikine@gmail.com



On Wed, May 19, 2021 at= 4:54 AM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Shane Mulligan <mullikine@gmail.com>
> 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/is= sues/2417) with the `emacs-helm` maintainer and we
> found what appears to be that the call to `accept-process-output` insi= de 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 comment= s surrounding,
>
> ```
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; accept-proces= s-output returned nil, maybe because the process
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; exited (and m= ay have been replaced with another).=C2=A0 If we got
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; 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.=C2=A0 In
> this case, the `C-g` emanating from `accept-process-output` was bubbli= ng 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 mi= nibuffer.
> https://asciinema.org/a/nAIB8Z1lGgZJqJg9Mt8YiN= EM9
>
> Here, I have added `while-no-input` and I no longer get the `quit`. > https://asciinema.org/a/x9ELZhwDP1IUtmOz0M1cly= 42H
>
> 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 ha= ve 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 wh= ile 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,
48500@debbugs.gn= u.org, on the CC list, so that others will see your
detailed descriptions.=C2=A0 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.
--0000000000005161eb05c2a93684--