all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Uwe Brauer <oub@mat.ucm.es>
Cc: 8366@debbugs.gnu.org
Subject: bug#8366: wish: include vc-annotate-goto-line
Date: Mon, 28 Mar 2011 13:49:48 -0400	[thread overview]
Message-ID: <jwvzkofkum6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8762r3nus5.fsf@gilgamesch.quim.ucm.es> (Uwe Brauer's message of "Mon, 28 Mar 2011 17:12:42 +0200")

> 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





  reply	other threads:[~2011-03-28 17:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28 15:12 bug#8366: wish: include vc-annotate-goto-line Uwe Brauer
2011-03-28 17:49 ` Stefan Monnier [this message]
2011-03-29  0:43   ` Juanma Barranquero
2011-03-29  3:32     ` Stefan Monnier
2011-04-24 19:43     ` Chong Yidong
2011-03-29  8:47   ` martin rudalics
2011-03-29 13:51     ` Stefan Monnier
2011-03-29 15:18       ` martin rudalics
2022-01-31 16:46 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvzkofkum6.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=8366@debbugs.gnu.org \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.