ring-insert+extend

ring-insert+extend is a compiled Lisp function in `ring.el'.

(ring-insert+extend RING ITEM &optional GROW-P)

Like `ring-insert', but if GROW-P is non-nil, then enlarge ring.
Insert onto ring RING the item ITEM, as the newest (last) item.
If the ring is full, behavior depends on GROW-P:
If GROW-P is non-nil, enlarge the ring to accommodate the new item.
If GROW-P is nil, dump the oldest item to make room for the new.