Function: emerge-find-difference1
emerge-find-difference1 is a byte-compiled function defined in
emerge.el.gz.
Signature
(emerge-find-difference1 ARG LOCATION BEGIN END)
Source Code
;; Defined in /usr/src/emacs/lisp/vc/emerge.el.gz
(defun emerge-find-difference1 (arg location begin end)
(let* ((index
;; find first difference containing or after the current position
(catch 'search
(let ((n 0))
(while (< n emerge-number-of-differences)
(let ((diff-vector (aref emerge-difference-list n)))
(if (<= location (marker-position (aref diff-vector end)))
(throw 'search n)))
(setq n (1+ n))))
emerge-number-of-differences))
(contains
;; whether the found difference contains the current position
(and (< index emerge-number-of-differences)
(<= (marker-position (aref (aref emerge-difference-list index)
begin))
location)))
(arg-value
;; numeric value of prefix argument
(prefix-numeric-value arg)))
(emerge-unselect-and-select-difference
(cond
;; if the point is in a difference, select it
(contains index)
;; if the arg is nil and the point is not in a difference, error
((null arg) (error "No difference contains point"))
;; if the arg is positive, select the following difference
((> arg-value 0)
(if (< index emerge-number-of-differences)
index
(error "No difference contains or follows point")))
;; if the arg is negative, select the preceding difference
(t
(if (> index 0)
(1- index)
(error "No difference contains or precedes point")))))))