all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 32986@debbugs.gnu.org, "João Távora" <joaotavora@gmail.com>
Subject: bug#32986: 27.0.50; unexpected delay in while-no-input + accept-process-output
Date: Fri, 11 Sep 2020 12:22:45 -0400	[thread overview]
Message-ID: <jwvo8mccmw0.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83sh1gzdey.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 08 Oct 2018 18:05:57 +0300")

>> I would expect while-no-input to break out of accept-process-output very
>> quickly after user keyboard input.  These expectations are met except
>> for some situations.
> I think your expectations are incorrect.

I beg to differ.

> My expectations are that if you call accept-process-output with
> a timeout of 30 sec, then while-no-input will return after 30 sec plus
> a small delay.

I'm OK if you don't consider it a "bug", but it does not satisfy the
needs behind `while-no-input`, so I think it's definitely something that
we should aim to improve.

The needs behind `while-no-input` often fail to be satisfied by our
C code, so this is not the first nor the last problem with it.
But if we can fix this case, Emacs will be better for it.

> First, one basic fact: accept-process-output calls
> wait_reading_process_output in a way that instructs it not to wait for
> keyboard input, you can see that clearly in the code (read_kbd is
> passed as zero).

What happens if we change this?

> This means that wait_reading_process_output will
> call pselect with the timeout of 30 sec (in your case), and will wait
> that long before it returns (unless there's a subprocess that gives us
> some stuff).  So why would you expect while-no-input that calls
> accept-process-output with that timeout to return earlier?

The question is not "given the current implementation, why should it
behave differently".  I expect it to return immediately because Emacs
is just there sitting idly so there is no good reason why it shouldn't
also check keyboard input at the same time as it's checking
process output.

> Therefore, to see the 30-sec delay, you need:
>
>   . stop all timers, which in "emacs -Q" means:
>     . disable blink-cursor-mode
>     . disable global-eldoc-mode
>     . disable font-lock-mode
>     . cancel the undo--auto-bindary-timer (I did that via list-timers)
>   . type "C-u C-x C-e", wait for a few seconds, and only then type SPC
>
> If I do all of the above, I see 30 sec plus a small delay every time I
> run your 2nd test.

IOW you cannot reliably expect it to wait 30s, so changing it so it
returns more promptly won't break any code.  That's good news.
All we need is for someone to come up with a patch.


        Stefan






      parent reply	other threads:[~2020-09-11 16:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 10:48 bug#32986: 27.0.50; unexpected delay in while-no-input + accept-process-output João Távora
2018-10-08 15:05 ` Eli Zaretskii
2018-10-08 20:06   ` João Távora
2018-10-08 20:25     ` Eli Zaretskii
2018-10-08 20:39       ` João Távora
2018-10-09  2:32         ` Eli Zaretskii
2018-10-09  8:47           ` João Távora
2018-10-09 15:01             ` Eli Zaretskii
2018-10-14 22:08               ` João Távora
2018-10-15 15:03                 ` Eli Zaretskii
2018-10-15 15:50                   ` João Távora
2018-12-11 18:09                 ` Dmitry Gutov
2018-12-12 21:42                   ` João Távora
2018-12-12 23:51                     ` Dmitry Gutov
2018-12-13 23:14                     ` Dmitry Gutov
2020-09-11 16:22   ` Stefan Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvo8mccmw0.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=32986@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.