Function: magit-diff-visit--position

magit-diff-visit--position is a byte-compiled function defined in magit-diff.el.

Signature

(magit-diff-visit--position BUFFER REV FILE GOTO-FROM GOTO-FILE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
(defun magit-diff-visit--position (buffer rev file goto-from goto-file)
  (and-let* ((hunk   (magit-diff--hunk-section))
             (line   (magit-diff-hunk-line   hunk goto-from))
             (column (magit-diff-hunk-column hunk goto-from)))
    (with-current-buffer buffer
      (save-restriction
        (widen)
        (goto-char (point-min))
        (forward-line
         (1- (pcase rev
               ((guard (not goto-file)) line)
               ("{worktree}" line)
               ("{index}" (magit-diff-visit--offset line file))
               (_ (magit-diff-visit--offset line file rev)))))
        (move-to-column column)
        (point)))))