Function: undo-delta

undo-delta is a byte-compiled function defined in simple.el.gz.

Signature

(undo-delta UNDO-ELT)

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
;; Return the first affected buffer position and the delta for an undo element
;; delta is defined as the change in subsequent buffer positions if we *did*
;; the undo.
(defun undo-delta (undo-elt)
  (if (consp undo-elt)
      (cond ((stringp (car undo-elt))
	     ;; (TEXT . POSITION)
	     (cons (abs (cdr undo-elt)) (length (car undo-elt))))
	    ((integerp (car undo-elt))
	     ;; (BEGIN . END)
	     (cons (car undo-elt) (- (car undo-elt) (cdr undo-elt))))
	    ;; (apply DELTA BEG END FUNC . ARGS)
	    ((and (eq (car undo-elt) 'apply) (integerp (nth 1 undo-elt)))
	     (cons (nth 2 undo-elt) (nth 1 undo-elt)))
	    (t
	     '(0 . 0)))
    '(0 . 0)))