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

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

bug#74936: 30.0.91; special-event-map does not respect t


From: Stefan Monnier
Subject: bug#74936: 30.0.91; special-event-map does not respect t
Date: Wed, 18 Dec 2024 18:37:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

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






reply via email to

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