GNU bug report logs - #8366
wish: include vc-annotate-goto-line

Previous Next

Package: emacs;

Reported by: Uwe Brauer <oub <at> mat.ucm.es>

Date: Mon, 28 Mar 2011 16:11:02 UTC

Severity: wishlist

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 8366 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Uwe Brauer <oub <at> mat.ucm.es>
Cc: 8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Mon, 28 Mar 2011 13:49:48 -0400
> I strongly suggesto to include this function.

Juanma, feel free to install such a feature.

> (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)

AFAIK there should be a better way to find the file.
E.g. vc-parent-buffer.

>                     (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)))))

Annotate buffer may display a different version that the one of the
checked out file.  E.g. because you have local uncommitted changes, or
because you asked for the annotations of an older revision.  So line
numbers may not fully match.  In general, there's no much we can do
about it, but we should probably try a bit harder than the above,
e.g. by looking for the closest line with the same text as the line
we're looking for.  Better would be to ask for a diff between the
annotated revision and the current file and use it to find out the
line-offset to use (for those cases where this method works).


        Stefan




This bug report was last modified 3 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.