I'm often making typing mistakes which will kick me out of the current function block (hitting M-n when I meant C-n). In such cases it would be nice to be able to return immediately to the previous cursor position. My understanding (correct me if I'm wrong) is that the mark ring is not ideally suited to this purpose because it requires setting the mark at positions ahead of time.
I guess I'm asking for a 'trailing mark ring' that stores all cursor positions, say, 2 or 3 moves back...or something like that.
C-s
to navigate to a new place in the file, you can return to your original spot by popping the mark withC-u C-<space>
. This is fairly common for functions that involve moving point around. I don't know whatM-n
is bound to in your example, but it's possible it does this too. – Tyler Feb 20 '17 at 2:56