Changes between Version 4 and Version 5 of HemlockProgrammer/RepresentationOfText


Ignore:
Timestamp:
Jan 13, 2008, 9:21:11 PM (12 years ago)
Author:
gz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HemlockProgrammer/RepresentationOfText

    v4 v5  
    44= 2. Representation of Text =
    55
     6In Hemlock, text is represented as a sequence of lines.  Newline characters
     7are never stored but are implicit between lines.  The
     8implicit newline character is treated as the single character `#\Newline` by the
     9text primitives.
     10
     11Text is broken into lines when it is first introduced into Hemlock.  Text enters
     12Hemlock from the outside world in two ways: reading a file, or pasting text
     13from the system clipboard.  Hemlock uses heuristics '''(which should be documented here!)'''
     14to decide what newline convention to use to convert the incoming text into its internal
     15representation as a sequence of lines.  Similarly it uses heuristics
     16'''(which should be documented here!)''' to convert the internal representation into
     17a string with embedded newlines in order to write a file or paste a region into
     18the clipboard.
     19
     20
    621== 2.1. Lines ==
    722
    8 In Hemlock all text is in some line. Text is broken into lines
    9 wherever it contains a newline character; newline characters are never
    10 stored, but are assumed to exist between every pair of lines.  The
    11 implicit newline character is treated as a single character by the
    12 text primitives.
     23A `line` is an object representing a sequence of characters with no line breaks.
    1324
    1425`linep` line [Function]
     
    2536that string.
    2637
    27 `line-previous` line [Function]
    28 
     38`line-previous` line [Function][[BR]]
    2939`line-next` line [Function]
    3040
     
    6878== 2.2. Marks ==
    6979
    70 A mark indicates a specific position within the text represented by a
     80A `mark` indicates a specific position within the text represented by a
    7181line and a character position within that line.  Although a mark is
    7282sometimes loosely referred to as pointing to some character, it in
     
    7686in the line, the next character is the newline character separating
    7787the current line from the next.  If the mark's line has no previous
    78 line, a mark withcharposof zero has no previous character; if the
     88line, a mark with charpos of zero has no previous character; if the
    7989mark's line has no next line, a mark with charpos equal to the length of
    8090the line has no next character.
     
    131141changes the mark's kind.
    132142
    133 `previous-character` mark [Function]
    134 
     143`previous-character` mark [Function][[BR]]
    135144`next-character` mark [Function]
    136145
     
    184193position in the buffer.
    185194
    186 
    187195`move-mark` mark new-position [Function]
    188196
     
    190198mark new-position and returns it.
    191199
    192 `line-start` mark &optional line [Function]
    193 
     200`line-start` mark &optional line [Function][[BR]]
    194201`line-end` mark &optional line [Function]
    195202
     
    197204line and returns it. Line defaults to mark's line.
    198205
    199 `buffer-start` mark &optional buffer [Function]
    200 
     206`buffer-start` mark &optional buffer [Function][[BR]]
    201207`buffer-end` mark &optional buffer [Function]
    202208
     
    206212from any buffer.
    207213
    208 `mark-before` mark [Function]
    209 
     214`mark-before` mark [Function][[BR]]
    210215`mark-after` mark [Function]
    211216
     
    232237== 2.3. Regions ==
    233238
    234 A region is simply a pair of marks: a starting mark and an ending
     239A `region` is simply a pair of marks: a starting mark and an ending
    235240mark.  The text in a region consists of the characters following the
    236241starting mark and preceding the ending mark (keep in mind that a mark
     
    265270from region with respect to data references --- marks, lines, text, etc.
    266271
    267 `region-to-string` region [Function]
    268 
     272`region-to-string` region [Function][[BR]]
    269273`string-to-region` string [Function]
    270274
     
    278282`:left-inserting`.
    279283
    280 `region-start` region [Function]
    281 
     284`region-start` region [Function][[BR]]
    282285`region-end` region [Function]
    283286