This page is about repeatedly using the same key or command and getting a different behavior each time. Such a key or command is no longer idempotent.
Starting with Emacs 23, ‘C-l’ (‘recenter-top-bottom’) is an example of this: When you hit ‘C-l’ it moves the current line (with point) to the middle, the top, or the bottom of the screen, in sequence: middle, top, bottom, middle,…
The code for this is in standard library GIT:window.el. It is based on ‘recenter-top-bottom’ from misc-cmds.el. See the source code for the technique used.
The following are additional ways to make a command or key act differently when it is repeated.
‘C-a’ and ‘C-e’ repeatedly to zip up and down the beginnings and ends of lines. First time: bol/eol, subsequently: next/previous line’s bol/eol. See commands `beginning-of-line+’ and `end-of-line+’ in misc-cmds.el. The keys are bound in setup-keys.el.‘visual-line-mode’, use ‘C-a’ and ‘C-e’ repeatedly to zip up and down the beginnings and ends of visual lines. And use ‘home’ and ‘end’ to move repeatedly across full, logical lines. See commands `beginning-of-visual-line+’ and `end-of-visual-line+’ in misc-cmds.el. The keys are bound in setup-keys.el.M-u/M-c/M-l to seq-(upcase|capitalize|downcase)-backward-word.