Function: majutsu-blob-visit-magit
majutsu-blob-visit-magit is an interactive and natively compiled
function defined in majutsu-file.el.
Signature
(majutsu-blob-visit-magit)
Documentation
Visit the current blob in magit-blob-mode.
Key Bindings
majutsu-blob-mode-map C-c m
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-file.el
(defun majutsu-blob-visit-magit ()
"Visit the current blob in `magit-blob-mode'."
(interactive)
(unless (and (bound-and-true-p majutsu-blob-mode)
majutsu-buffer-blob-root
majutsu-buffer-blob-path
majutsu-buffer-blob-revset)
(user-error "Not in a blob buffer"))
(let* ((line (line-number-at-pos))
(col (current-column))
(default-directory majutsu-buffer-blob-root))
(when (and (not majutsu-buffer-blob-commit-id)
majutsu-buffer-blob-revset)
(when-let* ((rev-info (majutsu-file--resolve-single-rev-info majutsu-buffer-blob-revset))
(new-change (plist-get rev-info :change-id)))
(setq majutsu-buffer-blob-revision new-change)
(setq majutsu-buffer-blob-change-id new-change)
(setq majutsu-buffer-blob-commit-id (plist-get rev-info :commit-id))
(majutsu-file--refresh-buffer-name)))
(let ((commit majutsu-buffer-blob-commit-id))
(unless (and commit (not (string-empty-p commit)))
(user-error "Revset does not resolve to a single commit"))
(unless (fboundp 'magit-find-file)
(require 'magit-files))
(let ((buf (magit-find-file commit majutsu-buffer-blob-path)))
(when (buffer-live-p buf)
(with-current-buffer buf
(majutsu-file--goto-line-col line col)))))))