[Top][All Lists]

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

RE: Recording a macro that preserves timing

From: Doug Lewan
Subject: RE: Recording a macro that preserves timing
Date: Thu, 4 Oct 2012 11:50:43 +0000


On occasion I've wanted such a thing too, but never looked into it.

>From the emacs lisp Info on "Keyboard Macros", their definition is controlled 
>by the variable defining-kbd-macro which comes from the C code. So, that would 
>be the place to look.

I find it (defining_kbd_macro in C) in keyboard.c and macros.c. It only appears 
18 times, so it shouldn't be *too* hard to copy or mimic or modify to meet your 
needs. You'd also have to consider doing corresponding work with kmacro.el (and 
maybe other places too).

With respect to editing: "C-x C-k e runs the command edit-kbd-macro,...."

You can save that definition and do whatever you need to with it. Indeed, the 
annotations in the keyboard macro editor generally give enough good hints that 
you could convert it into LISP, which would let you do very general programming 
with it.

I hope this helps.


Afterthought: By "*too* hard" I mean that I'm guessing it would take under a 
week of full time development. It might be a few hours, but I've never touched 
emacs' C code. 
I didn't see anything like this in the emacs TODO list. Perhaps you could make 
a feature request to

> -----Original Message-----
> From:
> [] On
> Behalf Of Juha Nieminen
> Sent: Thursday, 2012 October 04 06:22
> To:
> Subject: Recording a macro that preserves timing
> I can record (and then replay) keyboard macros in emacs. However, I
> would
> like a variant that also records the timing between the keypresses so
> that when it's played back, it does the exact same thing as when
> recording,
> with the same timing.
> Then I would like to be able to play said macro with a speed factor. In
> other words, I would like to be able to multiply all the recorded
> timings
> by a value (so that if I multiply them eg. by 0.5 the macro will play
> at
> twice the original speed).
> If possible, it would be nice if this macro could be saved to a file
> where it could be edited by hand (to eg. add or modify timings). In
> fact,
> it would be really great if it was saved in a format that would allow
> defining different factors for different groups of recorded keypresses
> (so that by editing the file I could define "this part should be played
> back with a factor of 0.5, this part with a factor of 0.2, etc.")
> How difficult would such elisp code be to make?

reply via email to

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