Oops, put the mode function in the hook, not the keymap.