Next: , Previous: , Up: Representation of Text   [Contents][Index]


2.1 Lines

In Hemlock all text is in some line. Text is broken into lines wherever it contains a newline character; newline characters are never stored, but are assumed to exist between every pair of lines. The implicit newline character is treated as a single character by the text primitives.

Function: linep line

This function returns t if line is a line object, otherwise nil.

Function: line-string line

Given a line, this function returns as a simple string the characters in the line. This is setf’able to set the line-string to any string that does not contain newline characters. It is an error to destructively modify the result of line-string or to destructively modify any string after the line-string of some line has been set to that string.

Function: line-previous line
Function: line-next line

Given a line, line-previous returns the previous line or nil if there is no previous line. Similarly, line-next returns the line following line or nil.

Function: line-buffer line

This function returns the buffer which contains this line. Since a line may not be associated with any buffer, in which case line-buffer returns nil.

Function: line-length line

This function returns the number of characters in the line. This excludes the newline character at the end.

Function: line-character line index

This function returns the character at position index within line. It is an error for index to be greater than the length of the line or less than zero. If index is equal to the length of the line, this returns a #\newline character.

Function: line-plist line

This function returns the property-list for line. setf, getf, putf and remf can be used to change properties. This is typically used in conjunction with line-signature to cache information about the line’s contents.

Function: line-signature line

This function returns an object that serves as a signature for a line’s contents. It is guaranteed that any modification of text on the line will result in the signature changing so that it is not eql to any previous value. The signature may change even when the text remains unmodified, but this does not happen often.


Next: Marks, Previous: Representation of Text, Up: Representation of Text   [Contents][Index]