fetsorn · 2022-03-25 09:10
When I record a sequence of keystrokes with start-kbd-macro and call it, emacs replays all keystrokes immediately. However I want it to replay keystrokes exactly as I typed them. So that calling the macro looked less like a shortcut and more like if a ghost writer was typing it. Adding intervals between keystrokes during playback won't suffice. How can I preserve the original delays between inputs?
upd: random intervals between keystrokes won't suffice either. Do you know of any existing package that records both the keystrokes and original delays?
arthurno1 · 2022-03-25 10:58
> How can I preserve the original delays between inputs?
Oh whauh. You can't normally do that. You will have to cook your own little elisp program to do this.
You could record time for each keystroke and store it somewhere along with the input, or rather deltas between last and previous input. You could than 'replay' input, i.e, with timer where you execute each command after the recorded 'delta' time interval.
But I don't think you really need to do it that complicated. You can just replay input yourself with some small delay, say a halv second or something like that, so you can see each command happen. If you really would like to simulate someone typing, just add some very small random delay interval before executing each command.
I don't know, just a thought, hope it helps. Good luck.
sachac · 2022-03-27 15:19
Not keyboard macros, but https://github.com/vermiculus/package-demo or https://github.com/howardabrams/demo-it/ might be useful for you.