Function: magit-find-file--restore-position

magit-find-file--restore-position is a byte-compiled function defined in magit-files.el.

Signature

(magit-find-file--restore-position BEFORE BLOB LINE COL)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-files.el
(defun magit-find-file--restore-position (before blob line col)
  (let ((file (magit-file-relative-name))
        (rev (or magit-buffer-revision-oid magit-buffer-revision "{worktree}")))
    (goto-char (point-min))
    (forward-line
     (1-
      (pcase (list before rev)
        ((guard (equal magit-buffer-blob-oid blob)) line)
        ('("{worktree}" "{worktree}") line)
        ('("{worktree}" "{index}")
         (magit-diff-visit--offset line file "-R"))
        (`("{worktree}" ,_)
         (magit-diff-visit--offset line file "-R" rev))
        ('("{index}" "{worktree}")
         (magit-diff-visit--offset line file))
        ('("{index}" "{index}")
         (magit-diff-visit--offset line (list blob magit-buffer-blob-oid file)))
        (`("{index}" ,_)
         (magit-diff-visit--offset line file "-R" "--cached"))
        (`(,_ "{worktree}")
         (magit-diff-visit--offset line file before))
        (`(,_ "{index}")
         (magit-diff-visit--offset line file "--cached"))
        (_
         (magit-diff-visit--offset line file before rev)))))
    (move-to-column col)))