Emacs provides a very easy way of binding complex sequences of keystrokes to a function or single key.
The macros is now accessable via
However it will only last as long as your session of emacs is open. In order for it to persist it must be entered into your .emacs file. Fortunately, emacs provides an easy way to do this:
Additionally, if you'd like to bind this to a key, add the following code to your .emacs, under the above:
For example, amongst other things, I have in my .emacs: