Function: diff--iterate-hunks

diff--iterate-hunks is a byte-compiled function defined in diff-mode.el.gz.

Signature

(diff--iterate-hunks MAX FUN)

Documentation

Iterate over all hunks between point and MAX.

Call FUN with two args (BEG and END) for each hunk.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/diff-mode.el.gz
(defun diff--iterate-hunks (max fun)
  "Iterate over all hunks between point and MAX.
Call FUN with two args (BEG and END) for each hunk."
  (save-excursion
    (let* ((beg (or (ignore-errors (diff-beginning-of-hunk))
                    (ignore-errors (diff-hunk-next) (point))
                    max)))
      (while (< beg max)
        (goto-char beg)
        (cl-assert (looking-at diff-hunk-header-re))
        (let ((end
               (save-excursion (diff-end-of-hunk) (point))))
          (cl-assert (< beg end))
          (funcall fun beg end)
          (goto-char end)
          (setq beg (if (looking-at diff-hunk-header-re)
                        end
                      (or (ignore-errors (diff-hunk-next) (point))
                          max))))))))