16.2 Ring Functions

There are various purposes in an editor for which a ring of values can be used, so Hemlock provides a general ring buffer type. It is used for maintaining a ring of killed regions (see section 4.3), a ring of marks (see section 3.1), or a ring of command strings which various modes and commands maintain as a history mechanism. [annotate]

make-ring  length &optional delete-function [Function]
          

Makes an empty ring object capable of holding up to length Lisp objects. Delete-function is a function that each object is passed to before it falls off the end. Length must be greater than zero. [annotate]

[annotate]

ringp  ring [Function]
          

Returns t if ring is a ring object, otherwise nil. [annotate]

[annotate]

ring-length  ring [Function]
          

Returns as multiple-values the number of elements which ring currently holds and the maximum number of elements which it may hold. [annotate]

[annotate]

ring-ref  ring index [Function]
          

Returns the index'th item in the ring, where zero is the index of the most recently pushed. This may be set with setf. [annotate]

[annotate]

ring-push  object ring [Function]
          

Pushes object into ring, possibly causing the oldest item to go away. [annotate]

[annotate]

ring-pop  ring [Function]
          

Removes the most recently pushed object from ring and returns it. If the ring contains no elements then an error is signalled. [annotate]

[annotate]

rotate-ring  ring offset [Function]
          

With a positive offset, rotates ring forward that many times. In a forward rotation the index of each element is reduced by one, except the one which initially had a zero index, which is made the last element. A negative offset rotates the ring the other way. [annotate]

[annotate]