0

From the description of the mark ring on the Emacs website (link) it seems to me that it is basically just a stack with a maximum size set to be 16. So I am curious why this data-structure is called a "ring" in Emacs parlance and not a mark "stack" which intuitively seems a more reasonable name.

As a side question, what is the mark ring internally implemented as?

  • It's a list. See the documentation that you linked. – Qudit Mar 23 '18 at 23:20
  • 1
    Just for info: What you call "the Emacs website (link)" is a web-page version of the Emacs manual, which you have access to within Emacs using C-h r. – Drew Mar 23 '18 at 23:40
  • Sorry; I meant that it is a web-page version of the Elisp manual, which you have access to within Emacs using C-h i and choosing Elisp. – Drew Mar 23 '18 at 23:48
1

The Elisp manual, node Rings, tells you about rings in Emacs.

It starts off with a description:

A ring is a fixed-size data structure that supports insertion, deletion, rotation, and modulo-indexed reference and traversal. An efficient ring data structure is implemented by the ring package. It provides the functions listed in this section.

Note that several rings in Emacs, like the kill ring and the mark ring, are actually implemented as simple lists, not using the ring package...

As you can see from the basic ring functions described there, a ring is not just a list or just a stack. It has its own set of properties.

But the mark-ring is a list (of former marks). It is used together with the (current) mark. You can use it like a stack, but you can also directly access any of its elements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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