Function: ring-index
ring-index is a byte-compiled function defined in ring.el.gz.
Signature
(ring-index INDEX HEAD RINGLEN VECLEN)
Documentation
Convert nominal ring index INDEX to an internal index.
The internal index refers to the items ordered from newest to oldest. HEAD is the index of the oldest element in the ring. RINGLEN is the number of elements currently in the ring. VECLEN is the size of the vector in the ring.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ring.el.gz
(defun ring-index (index head ringlen veclen)
"Convert nominal ring index INDEX to an internal index.
The internal index refers to the items ordered from newest to oldest.
HEAD is the index of the oldest element in the ring.
RINGLEN is the number of elements currently in the ring.
VECLEN is the size of the vector in the ring."
(setq index (mod index ringlen))
(mod (1- (+ head (- ringlen index))) veclen))