The new keymap is based on some `M-' keybindings. Instead of specifying each keybinding to enable or disable by hand, map through a new hashtable which contains function->wrapper mappings.
Instead of having to keep track of the keys in the keymap, let the macro handle it. Add `beginning-of-line' and `end-of-line' key bindings.