[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Updating marks in EMACS.

I recomend the following low-level algorithm for updating marks:
The list of marks is kept as a sorted list of real buffer offsets
(i.e. include the size of the gap when they're above it).  The
position of gap in the mark list is maintained.  The only mark
updating ever required is when the gap is moved, and when the gap
is widened.  In both cases the work required is proportional to
the number of marks in the characters moved/deleted.

For an implementation of this algorithm in Lisp, see
MC:EAK;BUFFER >.  There is also a Pascal version if you prefer.