Is there something like a point ring in Emacs?

I would like to store the current point in there using a command similar to point-to-register. But when I store another point, I want the previous one preserved. Later I want to list all the points in the ring and jump to one of them.

It would be really cool to have multiple of these rings and when these could be named and persisted.

  • 2
    You mean point, not pointer, correct? Maybe check out push-mark and friends. Also do C-h i g(emacs)Mark ring to read the Emacs doc.
    – NickD
    Mar 28, 2023 at 17:01
  • Point changes every time you move the cursor, so it it wouldn't be that useful (i.e., it would include every position you'd been at in a file). The mark-ring that Nick pointed you to is almost certainly more useful.
    – Tyler
    Mar 28, 2023 at 19:14
  • You got me wrong. I want to manually add points to the ring and manually recall them. Think of manually leaving breadcrumbs while browsing code.
    – Witek
    Mar 28, 2023 at 19:49
  • 2
    Isn't that what push-mark is doing?
    – NickD
    Mar 28, 2023 at 21:17

2 Answers 2


You need to read the Emacs manual about the mark-ring and the global-mark-ring.

The basics: Use C-SPC C-SPCto set the mark at some location. (The firstC-SPC` is enough to set it, but if that's all you want to do then you use the second one to also deactivate the region (mark).)

Each time you do this the location is added to the mark-ring. You can later use C-u C-SPC to return to the last-added location.


If you want to store positions only manually I have a library that can do that. It doesn't use a ring though, it uses a stack. You can download it from Codeberg. Put it in a path in your load-path (Type C-h v load-path RET to see its value) and in your init.el tell Emacs to load it

(require 'marker-stack)

Then tell the library not to save positions automatically

(setq marker-stack-functions-every-call nil)
(setq marker-stack-functions-first-call nil)

and bind the commands for saving a position and for navigating the history to some keys, for example

(global-set-key [f5] 'marker-stack-push)
(global-set-key (kbd "C-M-,") 'marker-stack-backward-stack-pop)
(global-set-key (kbd "C-M-.") 'marker-stack-forward-stack-pop)

That should do. One day I'll upload it to MELPA.

  • This seams what I am looking for. Almost. It is buffer local. I would like it global.
    – Witek
    Apr 16, 2023 at 17:00
  • 1
    @Witek Then take a look at the package I forked it from, github.com/dgutov/point-stack Apr 17, 2023 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.