This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see BuffersCowan in WG2's repo for R7RS-large.

Buffers­Cowan

cowan
2014-12-12 05:51:45
6history
source

Edit Buffers

This is a very preliminary description of edit buffers, basically mutable variable-length strings with some pointers into them. Temporarily, these functions are defined in terms of their Emacs Lisp equivalents, with the following exceptions:

Procedures

This list is very tentative, and may grow to include SRFI 13, or shrink to exclude unnecessary cruft, or both.

Whole buffers

(buffer? obj) == (bufferp object)

(buffer-modified? buffer) == (buffer-modified-p)

(buffer-modified! buffer) == (restore-buffer-modified-p t)

(buffer-unmodified! buffer) == (set-buffer-modified-p nil)

Constructors

(make-buffer [size-hint]) == simple constructor, no name provided

(buffer->string buffer) == (buffer-string)

Point

(buffer-point buffer) == (point)

(buffer-length buffer) == (buffer-size buffer)

(buffer-set-point! buffer integer) == (goto-char integer)

(buffer-point-increment) == (forward-char integer)

(buffer-skip-forward buffer string) == (skip-chars-forward string)

(buffer-skip-backward buffer string) == (skip-chars-forward string)

(buffer-point-at-start? buffer) == (bobp)

(buffer-point-at-end? buffer) == (eobp)

Markers

If the advancing? argument to make-marker is true, then if an insertion is done at the marker, the marker will automatically be repositioned to point to the end of the insertion.

(buffer-marker? obj) == (markerp obj)

(make-marker buffer marker-or-integer advancing?) == (copy-marker marker-or-integer insertion-type)

(marker-position marker) == (marker-position marker)

(marker-buffer marker) == (marker-buffer marker)

(marker-advancing? marker) == (marker-insertion-type marker)

(marker-set-position! marker position) == (set-marker marker position)

Accessors

(buffer-ref buffer [position]) == (char-after [position]), returns #f on failure

(buffer-set! buffer [position]) == no exact equivalent, does what you expect

(buffer-substring buffer start end) == (buffer-substring start end)

(buffer->string buffer) == (buffer-string)

Depending on #310, possibly consolidate the last two.

Comparison

buffer-comparator == No Emacs Lisp equivalent, not sure if ordering is appropriate.

Basic mutators

(buffer-insert! buffer . strings) == (buffer-insert . strings)

(buffer-insert-substring! to-buffer from-buffer [start [end]]) == (insert-buffer-substring ...)

(buffer-erase! buffer) == (erase-buffer)

(buffer-delete! buffer start end) == (delete-region start end)

(buffer-extract! buffer start end) == (delete-and-extract-region start end)

(buffer-delete-characters! buffer count) == (delete-char count)