unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Psionic K <psionik@positron.solutions>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org, Psionic K <psionik@positron.solutions>
Subject: Re: differentiating real and fake command events
Date: Sun, 15 Dec 2024 15:00:44 +0900	[thread overview]
Message-ID: <CADQMGASg+G6zU02JTDhpUeQvCUXhs8aTuDwhbLsqbrrNiFVgMw@mail.gmail.com> (raw)

> I don't understand enough of the context.  Could you explain in what way
> you need something different from `execute-kbd-macro`?

I'm implementing "live" demo features for dslide.  It relies on
playing back macros at human speed.  The goal is to emulate the
results of using Emacs by hand, to appear as a live demonstration, but
with reproducibility.  This frees the presenter from having to think
and type at the same time while still conveying the organic experience
to those watching.  Keyboard macros executed via `execute-kbd-macro'
replay input at inhuman speed and lose the similarity of feedback that
enables the audience to relate what they see with what they normally
do.

The first issue I ran into was simply getting `unread-command-events'
to result in input.  For my first pass solution, I accomplished this
with a function that calls itself recursively via `run-at-time'.  I
may try threads.

The recursive function currently also compares `last-input-event' to
detect incoherence caused by extra user inputs (and possibly others?).
If the last key pushed into `unread-command-events' doesn't match, it
messages and aborts.  This approach is invalid for replaying sequences
that will result in extra events.

Rather than detect potentially corrupting extra inputs, I would block
the user's inputs and allow only the synthetic events to succeed.  It
is unnatural to block the user from typing inputs while also pushing
synthetic input into `unread-command-events'.  One idea I had was to
activate a keymap in between pushing events.  However, I think this
would depend on the command loop evaluation order and wind up being
fragile.

I expect there are many paths that appear viable but only some that
are truly good and will remain so for at least a few years.



             reply	other threads:[~2024-12-15  6:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-15  6:00 Psionic K [this message]
2024-12-15 23:32 ` differentiating real and fake command events Stefan Monnier via Users list for the GNU Emacs text editor
2024-12-16  7:44 ` mbork
  -- strict thread matches above, loose matches on Subject: below --
2024-12-14  9:19 Psionic K
2024-12-14 14:14 ` Stefan Monnier via Users list for the GNU Emacs text editor

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=CADQMGASg+G6zU02JTDhpUeQvCUXhs8aTuDwhbLsqbrrNiFVgMw@mail.gmail.com \
    --to=psionik@positron.solutions \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
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).