unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: differentiating real and fake command events
Date: Sun, 15 Dec 2024 18:32:09 -0500	[thread overview]
Message-ID: <jwvpllsr1aj.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: CADQMGASg+G6zU02JTDhpUeQvCUXhs8aTuDwhbLsqbrrNiFVgMw@mail.gmail.com

> 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	other threads:[~2024-12-15 23:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-15  6:00 differentiating real and fake command events Psionic K
2024-12-15 23:32 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
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=jwvpllsr1aj.fsf-monnier+emacs@gnu.org \
    --to=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).