From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#8366: wish: include vc-annotate-goto-line Date: Mon, 28 Mar 2011 13:49:48 -0400 Message-ID: References: <8762r3nus5.fsf@gilgamesch.quim.ucm.es> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1301359052 8957 80.91.229.12 (29 Mar 2011 00:37:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 29 Mar 2011 00:37:32 +0000 (UTC) Cc: 8366@debbugs.gnu.org To: Uwe Brauer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 29 02:37:24 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4Mvz-0002Td-Fl for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Mar 2011 02:37:23 +0200 Original-Received: from localhost ([127.0.0.1]:57868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4Mvy-0000Y1-PA for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Mar 2011 20:37:22 -0400 Original-Received: from [140.186.70.92] (port=39244 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4Mvm-0000XX-Sm for bug-gnu-emacs@gnu.org; Mon, 28 Mar 2011 20:37:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4Mvl-00058f-Rq for bug-gnu-emacs@gnu.org; Mon, 28 Mar 2011 20:37:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4Mvl-00058a-P5 for bug-gnu-emacs@gnu.org; Mon, 28 Mar 2011 20:37:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q4Mqp-0004rY-GJ; Mon, 28 Mar 2011 20:32:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Mar 2011 00:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8366 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8366-submit@debbugs.gnu.org id=B8366.130135868518616 (code B ref 8366); Tue, 29 Mar 2011 00:32:03 +0000 Original-Received: (at 8366) by debbugs.gnu.org; 29 Mar 2011 00:31:25 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4MqC-0004qC-OK for submit@debbugs.gnu.org; Mon, 28 Mar 2011 20:31:24 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4MqB-0004pc-0j for 8366@debbugs.gnu.org; Mon, 28 Mar 2011 20:31:23 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id p2T0WSZS028583; Mon, 28 Mar 2011 20:32:29 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 6D5FA6653A; Mon, 28 Mar 2011 13:49:48 -0400 (EDT) In-Reply-To: <8762r3nus5.fsf@gilgamesch.quim.ucm.es> (Uwe Brauer's message of "Mon, 28 Mar 2011 17:12:42 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3810=0 X-NAI-Spam-Version: 2.2.0.9286 : core <3810> : streams <614374> : uri <837526> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 28 Mar 2011 20:32:03 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:45444 Archived-At: > 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