unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: radon.neon@gmail.com, 31692@debbugs.gnu.org
Subject: bug#31692: Emacs sometimes drops key events
Date: Thu, 07 Jun 2018 01:12:54 +0200	[thread overview]
Message-ID: <87vaav8q6h.fsf@web.de> (raw)
In-Reply-To: <83zi08vufl.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 06 Jun 2018 17:52:30 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> Not necessarily.  The forms of the body are aborted, as documented,
> and that includes discarding all input, so the character that
> interrupted while-no-input gets discarded as well.

I don't think discarding input is intended.  If you replace `sit-for' by
something else (a loop causing a delay, or a sleep for), it doesn't
discard the input.

> > For `aggressive-indent-mode' - I think they should use an idle timer:
> > Add something to `post-command-hook' that activates the timer, or
> > resets
> > the idle time when the timer is already there.  When the timer fires,
> > you don't need `sit-for' - and the problem only occurs when
> > `while-no-input' and `sit-for' are combined.  The timer just calls the
> > aggressive indent function wrapped in `while-no-input'.
>
> I actually don't understand why not use just sit-for.  Why is
> while-no-input needed on top of that?

Seems you never used `while-no-input', or at least not for the same
things as I did.

AFAIU the purpose of `while-no-input' is to make frequently occurring
"background" operations that last long enough to possibly interfere with
user interaction interruptable: hitting a key aborts the operation and
the editor is corresponding without delay.  And the command
corresponding to the hitten key is executed as normal.  Of course you
need to ensure that the aborted code always leaves thing in a consistent
state.

An automatic indent mode is a good example: you potentially want
re-indenting after any editing operation, but it is potentially slow and
would cause delays.  Using `while-no-input' let's you interrupt the
indentation operation and continue typing.  If you later make a long
enough typing pause, indentation will finish.  The `sit-for' is there to
avoid that indenting fires immediately after hitting a key, so that
interrupts are less common.

That's what I think is the purpose of `while-no-input'.  I use it here
and there, and never saw the behavior we see here.  It seems this only
happens if a `sit-for' is aborted inside the scope of a
`while-no-input'.


Michael.





  reply	other threads:[~2018-06-06 23:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-03  2:21 bug#31692: Emacs sometimes drops key events Radon Rosborough
2018-06-03  2:36 ` Eli Zaretskii
2018-06-03  4:54   ` Radon Rosborough
2018-06-03 15:05     ` Eli Zaretskii
2018-06-03 19:23       ` Alan Third
2018-06-04 10:41         ` João Távora
2018-06-05  0:59   ` Michael Heerdegen
2018-06-05  2:37     ` Eli Zaretskii
2018-06-05  2:41       ` Radon Rosborough
2018-06-05  4:11         ` Eli Zaretskii
2018-06-05 21:40           ` Michael Heerdegen
2018-06-06  2:37             ` Eli Zaretskii
2018-06-06  2:58               ` Michael Heerdegen
2018-06-06 14:52                 ` Eli Zaretskii
2018-06-06 23:12                   ` Michael Heerdegen [this message]
2018-06-07 15:20                     ` Eli Zaretskii
2018-06-06 14:45             ` Eli Zaretskii
2018-06-06 22:50               ` Michael Heerdegen
2018-06-07 15:20                 ` Eli Zaretskii
2018-06-07 15:30                   ` Stefan Monnier
2018-06-07 15:52                     ` Eli Zaretskii
2018-06-07 18:44                       ` Stefan Monnier
2018-06-08 22:17                         ` Michael Heerdegen
2018-06-11 21:08                           ` Michael Heerdegen
2018-06-12  2:27                             ` Eli Zaretskii
2018-06-16  8:26                               ` Eli Zaretskii
2018-06-16  8:28                           ` Eli Zaretskii
2018-06-17  4:39                             ` Michael Heerdegen
2018-07-05 19:07                             ` Michael Heerdegen
2018-07-05 19:27                               ` Eli Zaretskii
2018-07-06 17:43                                 ` Michael Heerdegen
2018-06-05  2:48       ` Michael Heerdegen
2018-06-05  4:13         ` Eli Zaretskii
2018-06-05 11:57           ` Noam Postavsky
2018-06-05 14:31             ` Eli Zaretskii
2018-06-05 21:39               ` Artur Malabarba
2018-06-06 14:39                 ` Eli Zaretskii
2018-06-03 12:13 ` Noam Postavsky

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87vaav8q6h.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=31692@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=radon.neon@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).