]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-annotate.el
lisp/textmodes/bibtex.el: various small bug fixes
[gnu-emacs] / lisp / vc / vc-annotate.el
index 271fce124290c0e1fe63f7eca37949e84dd8644f..b6ecc4c1d750561c3df808b881ddf0fa41c61670 100644 (file)
@@ -120,6 +120,7 @@ List of factors, used to expand/compress the time scale.  See `vc-annotate'."
   (let ((m (make-sparse-keymap)))
     (define-key m "a" 'vc-annotate-revision-previous-to-line)
     (define-key m "d" 'vc-annotate-show-diff-revision-at-line)
+    (define-key m "=" 'vc-annotate-show-diff-revision-at-line)
     (define-key m "D" 'vc-annotate-show-changeset-diff-revision-at-line)
     (define-key m "f" 'vc-annotate-find-revision-at-line)
     (define-key m "j" 'vc-annotate-revision-at-line)
@@ -128,6 +129,8 @@ List of factors, used to expand/compress the time scale.  See `vc-annotate'."
     (define-key m "p" 'vc-annotate-prev-revision)
     (define-key m "w" 'vc-annotate-working-revision)
     (define-key m "v" 'vc-annotate-toggle-annotation-visibility)
+    (define-key m "v" 'vc-annotate-toggle-annotation-visibility)
+    (define-key m "\C-m" 'vc-annotate-goto-line)
     m)
   "Local keymap used for VC-Annotate mode.")
 
@@ -673,6 +676,36 @@ The annotations are relative to the current time, unless overridden by OFFSET."
   ;; Pretend to font-lock there were no matches.
   nil)
 
+(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)))))
+
 (provide 'vc-annotate)
 
 ;;; vc-annotate.el ends here