[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vc-annotate and jump to a specific line
From: |
Juanma Barranquero |
Subject: |
Re: vc-annotate and jump to a specific line |
Date: |
Fri, 25 Mar 2011 00:34:48 +0100 |
On Thu, Mar 24, 2011 at 20:01, Uwe Brauer <address@hidden> wrote:
> Anybody know about such a function?
Something like that (warning: barely tested)
(defun vc-annotate-goto-line ()
(interactive)
(unless (eq major-mode 'vc-annotate-mode)
(error "vc-annotate-goto-line must be used on a VC-Annotate buffer"))
(let* ((name (buffer-name))
(base (and (string-match "Annotate \\(.*\\) (rev" name)
(match-string 1 name)))
(line (save-restriction
(widen)
(line-number-at-pos))))
(with-current-buffer (get-buffer base)
(pop-to-buffer (current-buffer))
(save-restriction
(widen)
(goto-char (point-min))
(forward-line (1- line))
(recenter)))))
Juanma