Function: magit-diff-visit-file--internal
magit-diff-visit-file--internal is a byte-compiled function defined in
magit-diff.el.
Signature
(magit-diff-visit-file--internal FORCE-WORKTREE DISPLAY)
Documentation
From a diff visit the appropriate version of FILE.
If FORCE-WORKTREE is non-nil, then visit the worktree version of the file, even if the diff is about a committed change. DISPLAY controls how the buffer is displayed. If nil display in the same window, if t display in another window, or if a function, use that to display.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
;;;;; Internal
(defun magit-diff-visit-file--internal (force-worktree display)
"From a diff visit the appropriate version of FILE.
If FORCE-WORKTREE is non-nil, then visit the worktree version of the
file, even if the diff is about a committed change. DISPLAY controls
how the buffer is displayed. If nil display in the same window, if
t display in another window, or if a function, use that to display."
(let ((file (or (magit-diff--file)
(user-error "Cannot determine file to visit"))))
(if (file-accessible-directory-p file)
(magit-diff-visit-directory file display)
(pcase-let ((`(,buf ,pos)
(magit-diff-visit-file--noselect force-worktree)))
(pcase display
('nil (pop-to-buffer-same-window buf))
('t (switch-to-buffer-other-window buf))
(_ (funcall display buf)))
(magit-diff-visit-file--setup buf pos)
buf))))