Function: ring-insert-at-beginning

ring-insert-at-beginning is a byte-compiled function defined in ring.el.gz.

Signature

(ring-insert-at-beginning RING ITEM)

Documentation

Add to RING the item ITEM, at the front, as the oldest item.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/ring.el.gz
(defun ring-insert-at-beginning (ring item)
  "Add to RING the item ITEM, at the front, as the oldest item."
  (let* ((vec (cddr ring))
         (veclen (length vec))
         (hd (car ring))
         (ln (cadr ring)))
    (setq ln (min veclen (1+ ln))
          hd (ring-minus1 hd veclen))
    (aset vec hd item)
    (setcar ring hd)
    (setcar (cdr ring) ln)))