Ranges

Create and query ranges

Function: range (beg end)
Create a range between BEG and END.
This normalizes range-beg and range-end, i.e. if END is before BEG, they are swapped.
Function: range-collapsed-p (range)
Test if RANGE is collapsed (range-beg and range-end are the same).
Function: inside-range-p (marker-or-pos range)
Test if MARKER-OR-POS is inside RANGE.
Function: inside-range-inclusive-p (marker-or-pos range)
Test if MARKER-OR-POS is inside RANGE, including range-end.

Range editing primitives

Function: extract-range (range)
Extract contents inside RANGE. This may extract part of a node, examples (^ marks range-beg and _ marks range-end): DOM before => DOM after, returned nodes ((a^ b) c (d _e)) => ((a)(e)), ( b) c (d ) ^(a (b _c) d) => ((c) d), (a (b ))
Function: delete-range (range)
Delete contents inside RANGE. This may delete part of a node, examples (^ marks range-beg and _ marks range-end): DOM before => DOM after ((a^ b) c (d _e)) => ((a)(e)) ^(a (b _c) d) => ((c) d)