Go to the first, previous, next, last section, table of contents.


Positions and Offsets

Although Jade stores the position of a character as a pair of two numbers many other programs define the position of a character as its offset from the beginning of the buffer or file it is in. The following functions may be used to convert between these two types of positions in a specified buffer.

Function: pos-to-offset &optional pos buffer
This function returns the offset of the character at the position pos (or the cursor position by default) in the specified buffer. This will be an integer, the first character in a buffer is represented by an offset of zero.

(pos-to-offset (pos 0 0))
    => 0

(pos-to-offset)
    => 195654

Function: offset-to-pos offset &optional buffer
Creates a new position object which contains the position of the character offset characters from the start of the specified buffer.

(offset-to-pos 0)
    => #<pos 0 0>

(offset-to-pos 195654)
    => #<pos 14 5974>


Go to the first, previous, next, last section, table of contents.