Skip navigation

Here’s another feature I just stumbled upon: emacs has the ability to remember the position where you have been in the buffer.

“Emacs keeps a stack memory of where you jump around your buffer. You can always get back to where you where by hitting C-u C-SPACE a few times (it’s easier than it looks). This is an extremely useful feature that no other editor has, as far as I know.” (read it as a comment at this post)

Whow, nice!
This is a good tip, until today I knew how to use registers, which means having to deliberately: mark a point in the document by doing: C-x r SPACE [a-z], and later jump to that point with C-x r j [a-z] (whatever single letter picked to identify that point when marking it)

With a quick look at the documentation I see that the mark-ring keeps the last 16 points you visited in the buffer, and start discarding them as the number grows bigger.

Oh, another finding, global marks, read about them in the manual:

In addition to the ordinary mark ring that belongs to each buffer, Emacs has a single global mark ring. It records a sequence of buffers in which you have recently set the mark, so you can go back to those buffers.

Setting the mark always makes an entry on the current buffer’s mark ring. If you have switched buffers since the previous mark setting, the new mark position makes an entry on the global mark ring also. The result is that the global mark ring records a sequence of buffers that you have been in, and, for each buffer, a place where you set the mark.

The command C-x C-SPC (pop-global-mark) jumps to the buffer and position of the latest entry in the global ring. It also rotates the ring, so that successive uses of C-x C-SPC take you to earlier and earlier buffers.

One Comment

  1. Thanks for good slug and title, it helped me to google this feature.

One Trackback/Pingback

  1. […] way?). I included a link to a post on the incredibly useful mark ring in emacs-links-2009-09 and here is another from […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: