### 6.3.10 Points

editor:point-kind

Function

``` editor:point-kind point ```

Returns the kind of the point, which is ``` :temporary``` , ``` :before-insert``` or ``` :after-insert``` .

A point's kind slot controls what happens to the point when text in the buffer is inserted or deleted.

``` :temporary``` points are for cases where you need read-only access to the buffer. They have a lower overhead than the other kinds of point and do not need to be explicitly deleted, but do not use them in cases where you make a point, insert or delete text and then use the point. Also, do not use them in cases where more than one thread can modify their buffer.

``` :before-insert``` and ``` :after-insert``` are for cases where you need to make a point, insert or delete text and still use the point afterwards.

The difference between these two kinds is what happens when text is inserted. For a point at position n from the start of the buffer, inserting len characters will leave the point at either position n or n + len according to the following table.

###### Editor point positions after text insertion

kind

Insert at < n

Insert at = n

Insert at > n

``` :before-insert```

n + len

n

n

``` :after-insert```

n + len

n + len

n

When text is deleted, ``` :before-insert``` and ``` :after-insert``` points are treated the same: points <= the start of the deletion remain unchanged, points >= the end of the deletion are moved with the text and points within the deleted region are automatically deleted and cannot be used again.

editor:current-point

Function

``` editor:current-point```

Returns the current point.

editor:current-mark

Function

``` editor:current-mark &optional pop-p no-error-p ```

Returns the current mark. If pop-p is ``` t``` , the mark is popped off the point ring. If no mark is set and no-error-p is ``` t``` , ``` nil``` is returned; otherwise an error is signalled. The default for both of these optional arguments is ``` nil``` .

editor:set-current-mark

Function

``` editor:set-current-mark point ```

Sets the current mark to be point .

editor:buffer-point

Function

``` editor:buffer-point buffer ```

Returns the current point in buffer .

editor:point<

Function

``` editor:point< point1 point2 ```

Returns non-``` nil``` if point1 is before point2 in the buffer.

editor:point>

Function

``` editor:point> point1 point2 ```

Returns non-``` nil``` if point1 is after point2 in the buffer.

editor:copy-point

Function

``` editor:copy-point point &optional kind new-point ```

Makes and returns a copy of point . The argument kind can take the value ``` :before``` , ``` :after``` , or``` :temporary``` . If new-point is supplied, the copied point is bound to that as well as being returned.

editor:move-point

Function

``` editor:move-point point new-position ```

Moves point to new-position , which should itself be a point.

editor:start-line-p

Function

``` editor:start-line-p point ```

Returns ``` t``` if point is immediately before the first character in a line, and ``` nil``` otherwise.

editor:end-line-p

Function

``` editor:end-line-p point ```

Returns ``` t``` if point is immediately after the last character in a line, and ``` nil``` otherwise.

editor:same-line-p

Function

``` editor:same-line-p point1 point2 ```

Returns ``` t``` if point1 and point2 are on the same line, and ``` nil``` otherwise.

editor:save-excursion

Macro

``` editor:save-excursion &rest body ```

Saves the location of the point and the mark and restores them after completion of body . This restoration is accomplished even when there is an abnormal exit from body .

LispWorks Editor User Guide (Macintosh version) - 23 Mar 2005