Jump around previous locations in a buffer

When you mark text using C-SPACE as described previously, emacs adds that location to the “mark ring”. This is just a list of places you have marked previously in a buffer. You can jump to the last place in the mark ring using C-u C-SPACE, then use C-u C-SPACE to keep going to previous places.

The neat thing is that emacs automatically adds marks for you when you do different things that jump you to a different place in a buffer (e.g. when you start a search or move to the start or end of the buffer) so C-u C-SPACE will often magically take you back to where you want to go. Try it – you’ll be surprised how often just does what you want.

If you know you will want to come back to a particular spot, just hit C-SPACE twice to mark that point.

Update

Reader Clément pointed out that my previous advice to use C-SPACE to continue cycling through the mark ring doesn’t work with default settings. Instead you should use C-u C-SPACE to keep moving back through the mark ring. If you want to be able to just use C-SPACE then you need to customise the variable set-mark-command-repeat-pop to be non-nil. See the emacs manual.

  • hackonteur

    I think you meant to say C-u C-SPACE.

    • Ben Maughan

      You are quite right. I’ve fixed the post. Thanks!