Next: , Previous: , Up: High-Level Text Primitives   [Contents][Index]


15.4 Logical Pages

Logical pages are a way of dividing a file into coarse divisions. This is analogous to dividing a paper into sections, and Hemlock provides primitives for moving between the pages of a file and listing a directory of the page titles. Pages are separated by Page Delimiter characters (see section sys-def-chars) that appear at the beginning of a line.

Function: goto-page mark n

This moves mark to the absolute page numbered n. If there are less than n pages, it signals an editor-error. If it returns, it returns mark. Hemlock numbers pages starting with one for the page delimited by the beginning of the buffer and the first Page Delimiter (or the end of the buffer).

Function: page-offset mark n

This moves mark forward n (-n backwards, if n is negative) Page Delimiter characters that are in the zero’th line position. If a Page Delimiter is the immediately next character after mark (or before mark, if n is negative), then skip it before starting. This always moves mark, and if there were enough pages to move over, it returns mark; otherwise, it returns nil.

Function: page-directory buffer

This returns a list of each first non-blank line in buffer that follows a Page Delimiter character that is in the zero’th line position. This includes the first line of the buffer as the first page title. If a page is empty, then its title is the empty string.

Function: display-page-directory stream directory

This writes the list of strings, directory, to stream, enumerating them in a field three wide. The number and string are separated by two spaces, and the first line contains headings for the page numbers and title strings.


Next: Filling, Previous: English Text Buffers, Up: High-Level Text Primitives   [Contents][Index]