Function: vc-annotate-goto-line

vc-annotate-goto-line is an interactive and byte-compiled function defined in vc-annotate.el.gz.

Signature

(vc-annotate-goto-line)

Documentation

Go to the line corresponding to the current VC Annotate line.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-annotate.el.gz
(defun vc-annotate-goto-line ()
  "Go to the line corresponding to the current VC Annotate line."
  (interactive)
  (unless (eq major-mode 'vc-annotate-mode)
    (error "Not in a VC-Annotate buffer"))
  (let ((line (save-restriction
		(widen)
		(line-number-at-pos)))
	(rev vc-annotate-parent-rev))
    (pop-to-buffer
     (or (and (buffer-live-p vc-parent-buffer)
	      vc-parent-buffer)
	 (and (file-exists-p vc-annotate-parent-file)
	      (find-file-noselect vc-annotate-parent-file))
	 (error "File not found: %s" vc-annotate-parent-file)))
    (save-restriction
      (widen)
      (goto-char (point-min))
      (forward-line (1- line))
      (recenter))
    ;; Issue a warning if the lines might be incorrect.
    (cond
     ((buffer-modified-p)
      (message "Buffer modified; annotated line numbers may be incorrect"))
     ((not (eq (vc-state buffer-file-name) 'up-to-date))
      (message "File is not up-to-date; annotated line numbers may be incorrect"))
     ((not (equal rev (vc-working-revision buffer-file-name)))
      (message "Annotations were for revision %s; line numbers may be incorrect"
	       rev)))))