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:
This list is very tentative, and may grow to include SRFI 13, or shrink to exclude unnecessary cruft, or both.
(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)
(make-buffer [size-hint]) == simple constructor, no name provided
(buffer->string buffer) == (buffer-string)
(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)
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)
(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.
No direct Emacs Lisp equivalents, but based on compare-buffer-substrings. Should probably be in a separate module because of its Unicode implications.
(buffer-substring=? buffer1 start1 end1 buffer2 start2 end2)
similarly buffer-substring<?, buffer-substring>?, buffer-substring<=?, buffer-substring>=?, and -ci and -ni analogues.
(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)
Should probably be in a separate module because of its Unicode implications.
(buffer-downcase! buffer start end) == (upcase-region start end)
(buffer-upcase! buffer start end) == (downcase-region start end)
(buffer-foldcase! buffer start end) = analogous to downcase-region