Function: majutsu-annotate-visit-other-file

majutsu-annotate-visit-other-file is an interactive and natively compiled function defined in majutsu-annotate.el.

Signature

(majutsu-annotate-visit-other-file)

Documentation

Visit the blob related to the current chunk's parent revision.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-annotate.el
(defun majutsu-annotate-visit-other-file ()
  "Visit the blob related to the current chunk's parent revision."
  (interactive)
  (let* ((chunk (majutsu-annotate-current-chunk))
         (prev-rev (majutsu-annotate-chunk-prev-rev chunk))
         (orig-line (majutsu-annotate-chunk-orig-line chunk)))
    (unless prev-rev
      (user-error "Chunk has no further history"))
    ;; Get file path from parent - use current file for now
    (let ((file (or (bound-and-true-p majutsu-buffer-blob-path)
                    (and buffer-file-name
                         (file-relative-name buffer-file-name (majutsu-toplevel))))))
      ;; Check if file exists in parent revision
      (unless (majutsu-annotate--file-exists-p prev-rev file)
        (user-error "File does not exist in revision %s" prev-rev))
      (majutsu-find-file prev-rev file)
      ;; Jump to original line
      (goto-char (point-min))
      (forward-line (1- orig-line)))))