I want to repeat a function when the last key in the key binding is repeatedly pressed.

For example, say the keybinding is C-n for next-line, what I want to happen is that next-line is repeated when I just press n. Also, I need some way to end the repetition. Ideally any other key press should do what it normally does.

I have no idea where to begin with this so no close attempts I could show.

Note: In the example above it's not actually important that C-n runs the function. The first execution of the function could be on the first separate n key press.



Browse other questions tagged or ask your own question.