Carl Cerecke wrote:
Hi,
I've got the following shortcut keys defined for macros:
(global-set-key [f8] 'start-kbd-macro)
(global-set-key [f9] 'end-kbd-macro)
(global-set-key [f10] 'call-last-kbd-macro)
Now I'd like to bind the last kbd macro to (say) the key f2 with a
single keyboard shortcut.
In other words, after defining a macro, I want to be able to press C-f2,
and thereafter pressing f2 executes that macro.
FINE! I'll answer it myself then!
Stick this in your init.el and repeat for as many fx keys as you want.
(global-set-key '(shift f2) (lambda ()
(interactive)
(assign-last-kbd-macro-to-key 'f2)))
Cheers,
Carl.