Function: ring-previous

ring-previous is a byte-compiled function defined in ring.el.gz.

Signature

(ring-previous RING ITEM)

Documentation

Return the previous item in the RING, before ITEM.

Raise error if ITEM is not in the RING.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ring.el.gz
(defun ring-previous (ring item)
  "Return the previous item in the RING, before ITEM.
Raise error if ITEM is not in the RING."
  (let ((curr-index (ring-member ring item)))
    (unless curr-index (error "Item is not in the ring: `%s'" item))
    (ring-ref ring (ring-minus1 curr-index (ring-length ring)))))