Function: ring-remove+insert+extend
ring-remove+insert+extend is a byte-compiled function defined in
ring.el.gz.
Signature
(ring-remove+insert+extend RING ITEM &optional GROW-P)
Documentation
ring-remove ITEM from RING, then ring-insert+extend it.
This ensures that there is only one ITEM on RING.
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-remove+insert+extend (ring item &optional grow-p)
"`ring-remove' ITEM from RING, then `ring-insert+extend' it.
This ensures that there is only one ITEM on RING.
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."
(let (ind)
(while (setq ind (ring-member ring item))
(ring-remove ring ind)))
(ring-insert+extend ring item grow-p))