anchor.diff:            region-end
             apply-region-lines))
   
  -(defun first-line-p (marker)
  -  (<= (point-linum marker) 1))
  -
  -(defun last-line-p (marker)
  -  (<= (buffer-nlines (point-buffer marker))
  -      (point-linum marker)))
  -
  -(defun start-line-p (marker)
  -  (zerop (point-charpos marker)))
  -
  -(defun end-line-p (marker)
  -  (= (point-charpos marker)
  -     (buffer-line-length (point-buffer marker)
  -                         (point-linum marker))))
  -
  -(defun start-buffer-p (marker)
  -  (and (first-line-p marker)
  -       (start-line-p marker)))
  -
  -(defun end-buffer-p (marker)
  -  (and (last-line-p marker)
  -       (end-line-p marker)))
  -
  -(defun line-start (marker)
  -  (setf (point-charpos marker) 0)
  -  marker)
  -
  -(defun line-end (marker)
  -  (setf (point-charpos marker)
  -        (buffer-line-length (point-buffer marker)
  -                            (point-linum marker)))
  -  marker)
  -
  -(defun buffer-start (marker)
  -  (move-point marker (buffers-start (point-buffer marker))))
  -
  -(defun buffer-end (marker)
  -  (move-point marker (buffers-end (point-buffer marker))))
  -
  -(defun move-point (marker new-marker)
  -  (let ((buffer (point-buffer marker)))
  -    (setf (point-linum marker)
  -          (min (point-linum new-marker)
  +(defun first-line-p (point)
  +  (<= (point-linum point) 1))
  +
  +(defun last-line-p (point)
  +  (<= (buffer-nlines (point-buffer point))
  +      (point-linum point)))
  +
  +(defun start-line-p (point)
  +  (zerop (point-charpos point)))
  +
  +(defun end-line-p (point)
  +  (= (point-charpos point)
  +     (buffer-line-length (point-buffer point)
  +                         (point-linum point))))
  +
  +(defun start-buffer-p (point)
  +  (and (first-line-p point)
  +       (start-line-p point)))
  +
  +(defun end-buffer-p (point)
  +  (and (last-line-p point)
  +       (end-line-p point)))
  +
  +(defun line-start (point)
  +  (setf (point-charpos point) 0)
  +  point)
  +
  +(defun line-end (point)
  +  (setf (point-charpos point)
  +        (buffer-line-length (point-buffer point)
  +                            (point-linum point)))
  +  point)
  +
  +(defun buffer-start (point)
  +  (move-point point (buffers-start (point-buffer point))))
  +
  +(defun buffer-end (point)
  +  (move-point point (buffers-end (point-buffer point))))
  +
  +(defun move-point (point new-point)
  +  (let ((buffer (point-buffer point)))
  +    (setf (point-linum point)
  +          (min (point-linum new-point)
                  (buffer-nlines buffer)))
  -    (setf (point-charpos marker)
  -          (min (buffer-line-length buffer (point-linum marker))
  -               (point-charpos new-marker))))
  -  marker)
  -
  -(defun same-line-p (marker1 marker2)
  -  (assert (eq (point-buffer marker1)
  -              (point-buffer marker2)))
  -  (= (point-linum marker1)
  -     (point-linum marker2)))
  -
  -(defun line-offset (marker n &optional (charpos 0))
  -  (let ((linum (point-linum marker)))
  +    (setf (point-charpos point)
  +          (min (buffer-line-length buffer (point-linum point))
  +               (point-charpos new-point))))
  +  point)
  +
  +(defun same-line-p (point1 point2)
  +  (assert (eq (point-buffer point1)
  +              (point-buffer point2)))
  +  (= (point-linum point1)
  +     (point-linum point2)))
  +
  +(defun line-offset (point n &optional (charpos 0))
  +  (let ((linum (point-linum point)))
       (if (plusp n)
           (dotimes (_ n)
  -          (when (<= (buffer-nlines (point-buffer marker)) linum)
  +          (when (<= (buffer-nlines (point-buffer point)) linum)
               (return-from line-offset nil))
             (incf linum))
           (dotimes (_ (- n))
             (when (= linum 1)
               (return-from line-offset nil))
             (decf linum)))
  -    (setf (point-linum marker) linum))
  -  (setf (point-charpos marker)
  +    (setf (point-linum point) linum))
  +  (setf (point-charpos point)
           (if (< 0 charpos)
               (min charpos
  -                 (length (line-string-at marker)))
  +                 (length (line-string-at point)))
               0))
  -  marker)
  -
  -(defun %character-offset-positive (marker n)
  -  (let ((charpos (point-charpos marker))
  -        (linum (point-linum marker)))
  +  point)
  +
  +(defun %character-offset-positive (point n)
  +  (let ((charpos (point-charpos point))
  +        (linum (point-linum point)))
       (loop
         (when (minusp n)
  -        (setf (point-charpos marker) charpos)
  -        (setf (point-linum marker) linum)
  +        (setf (point-charpos point) charpos)
  +        (setf (point-linum point) linum)
           (return nil))
  -      (let* ((length (1+ (buffer-line-length (point-buffer marker)
  -                                             (point-linum marker))))
  -             (w (- length (point-charpos marker))))
  +      (let* ((length (1+ (buffer-line-length (point-buffer point)
  +                                             (point-linum point))))
  +             (w (- length (point-charpos point))))
           (when (< n w)
  -          (incf (point-charpos marker) n)
  -          (return marker))
  +          (incf (point-charpos point) n)
  +          (return point))
           (decf n w)
  -        (unless (line-offset marker 1)
  -          (setf (point-charpos marker) charpos)
  -          (setf (point-linum marker) linum)
  +        (unless (line-offset point 1)
  +          (setf (point-charpos point) charpos)
  +          (setf (point-linum point) linum)
             (return nil))))))
   
  -(defun %character-offset-negative (marker n)
  -  (let ((charpos (point-charpos marker))
  -        (linum (point-linum marker)))
  +(defun %character-offset-negative (point n)
  +  (let ((charpos (point-charpos point))
  +        (linum (point-linum point)))
       (loop
         (when (minusp n)
  -        (setf (point-charpos marker) charpos)
  -        (setf (point-linum marker) linum)
  +        (setf (point-charpos point) charpos)
  +        (setf (point-linum point) linum)
           (return nil))
  -      (when (<= n (point-charpos marker))
  -        (decf (point-charpos marker) n)
  -        (return marker))
  -      (decf n (1+ (point-charpos marker)))
  -      (cond ((first-line-p marker)
  -             (setf (point-charpos marker) charpos)
  -             (setf (point-linum marker) linum)
  +      (when (<= n (point-charpos point))
  +        (decf (point-charpos point) n)
  +        (return point))
  +      (decf n (1+ (point-charpos point)))
  +      (cond ((first-line-p point)
  +             (setf (point-charpos point) charpos)
  +             (setf (point-linum point) linum)
                (return nil))
               (t
  -             (line-offset marker -1)
  -             (line-end marker))))))
  -
  -(defun character-offset (marker n)
  +             (line-offset point -1)
  +             (line-end point))))))
  +
  +(defun character-offset (point n)
     (if (plusp n)
  -      (%character-offset-positive marker n)
  -      (%character-offset-negative marker (- n))))
  -
  -(defun character-at (marker &optional (offset 0))
  +      (%character-offset-positive point n)
  +      (%character-offset-negative point (- n))))
  +
  +(defun character-at (point &optional (offset 0))
     (if (zerop offset)
  -      (buffer-get-char (point-buffer marker)
  -                       (point-linum marker)
  -                       (point-charpos marker))
  -      (with-point ((temp-marker marker))
  -        (when (character-offset temp-marker offset)
  -          (character-at temp-marker 0)))))
  -
  -(defun insert-char-at (marker char &optional (n 1))
  -  (loop :repeat n :do (insert-char/marker marker char))
  -  t)
  -
  -(defun insert-string-at (marker string)
  +      (buffer-get-char (point-buffer point)
  +                       (point-linum point)
  +                       (point-charpos point))
  +      (with-point ((temp-point point))
  +        (when (character-offset temp-point offset)
  +          (character-at temp-point 0)))))
  +
  +(defun insert-char-at (point char &optional (n 1))
  +  (loop :repeat n :do (insert-char/marker point char))
  +  t)
  +
  +(defun insert-string-at (point string)
     (cond ((lem.text-property:text-property-p string)
            (let ((str (lem.text-property:text-property-string string)))
  -           (with-point ((start-marker marker))
  -             (insert-string/marker marker str)
  -             (let ((end-marker (character-offset (copy-point start-marker :temporary)
  +           (with-point ((start-point point))
  +             (insert-string/marker point str)
  +             (let ((end-point (character-offset (copy-point start-point :temporary)
                                                    (length str))))
                  (loop :for (k v) :on (lem.text-property:text-property-plist string) :by #'cddr
  -                     :do (put-text-property start-marker end-marker k v))))))
  +                     :do (put-text-property start-point end-point k v))))))
           (t
  -         (insert-string/marker marker string)))
  -  t)
  -
  -(defun delete-char-at (marker &optional (n 1) killp)
  +         (insert-string/marker point string)))
  +  t)
  +
  +(defun delete-char-at (point &optional (n 1) killp)
     (when (minusp n)
  -    (unless (character-offset marker n)
  +    (unless (character-offset point n)
         (return-from delete-char-at nil))
       (setf n (- n)))
  -  (unless (end-buffer-p marker)
  -    (let ((string (delete-char/marker marker n)))
  +  (unless (end-buffer-p point)
  +    (let ((string (delete-char/marker point n)))
         (when killp
           (kill-push string))
         t)))
  
positive.code:                                            end)
                                         key))))
  
  (defun next-single-property-change (marker property-name &optional limit-marker)
    (let ((first-value (text-property-at marker property-name))
          (start-marker (copy-point marker :temporary)))
      (loop
        (unless (character-offset marker 1)
          (move-point marker start-marker)
          (return nil))
        (unless (eq first-value (text-property-at marker property-name))
          (return marker))
        (when (and limit-marker (point<= limit-marker marker))
          (move-point marker start-marker)
          (return nil)))))
  
  (defun previous-single-property-change (marker property-name &optional limit-marker)
    (let ((first-value (text-property-at marker property-name -1))
          (start-marker (copy-point marker :temporary)))
      (loop
        (unless (eq first-value (text-property-at marker property-name -1))
          (return marker))
        (unless (character-offset marker -1)
          (move-point marker start-marker)
          (return nil))
        (when (and limit-marker (point>= limit-marker marker))
          (move-point marker start-marker)
          (return nil)))))
  
  (defun line-string-at (marker)
    (buffer-line-string (point-buffer marker)
                        (point-linum marker)))
  
  (defun point-column (marker)
    (string-width (line-string-at marker)
                  0
                  (point-charpos marker)))
  
  (defun move-to-column (marker column &optional force)
    (line-end marker)
    (let ((cur-column (point-column marker)))
      (cond ((< column cur-column)
             (setf (point-charpos marker)
                   (wide-index (line-string-at marker) column))
             marker)
            (force
             (insert-char-at marker #\space (- column cur-column))
             (line-end marker))
            (t
             (line-end marker)))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
negative.code:   (buffer-mark-cancel buffer)
    (delete-char/marker (buffer-point buffer) t))
  
  (defun text-property-at (point key &optional (offset 0))
    (if (zerop offset)
        (line-search-property (get-line/marker point) key (point-charpos point))
        (with-point ((temp-point point))
          (when (character-offset temp-point offset)
            (text-property-at temp-point key 0)))))
  
  (defun put-text-property (start-point end-point key value)
    (assert (eq (point-buffer start-point)
                (point-buffer end-point)))
    (%map-region start-point end-point
                 (lambda (line start end)
                   (line-add-property line
                                      start
  