help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: differentiating real and fake command events


From: Stefan Monnier
Subject: Re: differentiating real and fake command events
Date: Sun, 15 Dec 2024 18:32:09 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> 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.
[...]

Hmm...

> 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.

Yeah, I think the easiest path is to tell the user "don't touch
anything".

One trick that you could try is to use `special-event-map`.  AFAICT from
reading the code of `read_char`, this map is consulted for "real" events
but not for events coming from `unread-command-events`, so maybe
something like:

    (define-key special-event-map [t] #'my-consume-real-input)
    (defvar my-stashed-real-input nil)
    (defun my-consume-real-input ()
      (interactive)
      (push last-input-event my-stashed-real-input))

Hmm... it looks like the "default binding" feature (i.e. the [t] above)
is not used when consulting that `special-event-map`, so that won't work
(you'd need a "magic" keymap which has a binding for all possible events).

Maybe you should log a feature request with `M-x report-emacs-bug`.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]