I've defined one keyboard macro, bound to keystroke 1
, say, and I want to define a second keyboard macro that executes the first one indefinitely and then returns to the beginning of the buffer. I assume that the first one always terminates if iterated indefinitely. E.g., it could be a keyboard macro that operates on a line and then moves to the next line.
To define the new keyboard macro, I naively want to type:
C-x (
C-u 0
C-x C-k 1
C-u C-u C-x (
M-<
C-x )
In other words, C-x (
to begin recording, C-u 0
to specify indefinite execution, C-x C-k 1
to specify that the indefinite execution refers to keyboard macro 1, C-u C-u C-x (
to resume recording the new keyboard macro (since recording automatically terminates after the last iteration of keyboard macro 1), M-<
to return to the beginning of the buffer, and finally C-x )
to end recording.
If I bind all of that to a new key sequence and then invoke it, I find that this new keyboard macro goes as far as to execute keyboard macro 1 (as many times as it can) but fails to finish with the M-<
. Am I doing something wrong? Is there another way to achieve what I want?