Function: majutsu-diff--hunk-line

majutsu-diff--hunk-line is a natively compiled function defined in majutsu-diff.el.

Signature

(majutsu-diff--hunk-line SECTION GOTO-FROM)

Documentation

Return the line number in SECTION for GOTO-FROM side.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-diff--hunk-line (section goto-from)
  "Return the line number in SECTION for GOTO-FROM side."
  (save-excursion
    (goto-char (line-beginning-position))
    (with-slots (content from-range to-range) section
      (when (or from-range to-range)
        (when (< (point) content)
          (goto-char content)
          (re-search-forward "^[-+]"))
        (+ (car (if goto-from from-range to-range))
           (let ((target (point))
                 (offset 0))
             (goto-char content)
             (while (< (point) target)
               (let ((ch (char-after)))
                 (cond
                  ((eq ch ?+) (unless goto-from (cl-incf offset)))
                  ((eq ch ?-) (when goto-from (cl-incf offset)))
                  (t (cl-incf offset))))
               (forward-line))
             offset))))))