ring

Homepage: https://www.gnu.org/software/emacs

Summary

Handle rings of items

Commentary

This code defines a ring data structure.  A ring is a
    (hd-index length . vector)
list.  You can insert to, remove from, and rotate a ring.  When the ring
fills up, insertions cause the oldest elts to be quietly dropped.

In ring-ref, 0 is the index of the newest element.  Higher indexes
correspond to older elements; when the index equals the ring length,
it wraps to the newest element again.

hd-index = vector index of the oldest ring item.
        Newer items follow this item; at the end of the vector,
        they wrap around to the start of the vector.
length = number of items currently in the ring.
        This never exceeds the length of the vector itself.

These functions are used by the input history mechanism, but they can
be used for other purposes as well.

Reverse dependencies