From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Psionic K <psionik@positron.solutions>, 74936@debbugs.gnu.org
Subject: bug#74936: 30.0.91; special-event-map does not respect t
Date: Wed, 18 Dec 2024 18:37:03 -0500 [thread overview]
Message-ID: <jwv4j30k1y2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86h671m6v0.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 18 Dec 2024 15:57:23 +0200")
>> This is necessary to differentiate real user input from fake user input
>> performed during automated playback
>> functionality. We need to capture events before `read-event` and buffer
>> them for later playback. Since I
>> can't predict all of the bindings I would otherwise need to cover, the
>> t binding would be a great help.
>
> Stefan, any comments?
They're trying to implement something similar to the built-in keyboard
macros but where the replay is done at the same speed as the original
recording, with the same kind of "idling" in-between, so they need some
way to detect if we receive a "real" event while replaying the
recorded events.
Looking at `read_char` I saw that a possible solution is to use
a catchall `[t]` binding in `special-event-map` since this map is
applied to incoming real events but not to events coming from
`unread-command-events`.
But `read_char` call `access_keymap` with `t_ok == false` when
consulting `special-event-map` so that suggestion of mine currently
can't work.
Hence his request.
Of course, their needs could be satisfied in many other ways, but the
patch below does seem cheap and harmless.
A big caveat, tho: I don't know that the patch is sufficient to satisfy
their needs. Psionic, could you apply the patch below to a local build
of Emacs, and then play with it in your package to confirm that it
indeed makes your life easier?
Stefan
diff --git a/src/keyboard.c b/src/keyboard.c
index 6d28dca9aeb..cd3251e04e3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3065,7 +3065,7 @@ read_char (int commandflag, Lisp_Object map,
and loop around to read another event. */
save = Vquit_flag;
Vquit_flag = Qnil;
- tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, 0, 0, 1);
+ tem = access_keymap (get_keymap (Vspecial_event_map, 0, 1), c, true, 0, 1);
Vquit_flag = save;
if (!NILP (tem))
prev parent reply other threads:[~2024-12-18 23:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 6:41 bug#74936: 30.0.91; special-event-map does not respect t Psionic K
2024-12-18 13:57 ` Eli Zaretskii
2024-12-18 23:37 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [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
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=jwv4j30k1y2.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=74936@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=psionik@positron.solutions \
/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).