Function: ring-insert+extend
ring-insert+extend is a byte-compiled function defined in ring.el.gz.
Signature
(ring-insert+extend RING ITEM &optional GROW-P)
Documentation
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.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ring.el.gz
(defun 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."
(and grow-p
(= (ring-length ring) (ring-size ring))
(ring-extend ring 1))
(ring-insert ring item))