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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8366 in the body.
You can then email your comments to 8366 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Mon, 28 Mar 2011 16:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Uwe Brauer <oub <at> mat.ucm.es>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 28 Mar 2011 16:11:02 GMT) Full text and rfc822 format available.

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

From: Uwe Brauer <oub <at> mat.ucm.es>
To: bug-gnu-emacs <at> gnu.org
Subject: wish: include vc-annotate-goto-line
Date: Mon, 28 Mar 2011 17:12:42 +0200
Hello

some days ago Juanma Barranquero wrote a very useful function which allows 
you to jump from the vc-annotate buffer to the corresponding point in the
file which is under vc. 


I strongly suggesto to include this function.

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

Uwe Brauer 

In GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2010-03-26 on palmer, modified by Ubuntu
Windowing system distributor `The X.Org Foundation', version 11.0.10600000
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Apropos

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
y e s C-g C-x C-q C-x v v y y e s <return> y e s <return> 
C-x 2 C-x C-f C-g C-x o C-x o C-x 1 C-x C-f <backspace> 
<return> g <down> <down> <up> <up> <up> <up> <up> <down> 
f <end> <C-f1> <up> <up> <up> <up> <return> <return> 
<return> <return> <return> <up> <up> <up> C-x 2 C-x 
C-f <M-backspace> x e <tab> / s i <tab> v <tab> <M-backspace> 
<M-backspace> <M-backspace> <return> s <C-home> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <up> <up> <up> <up> <up> <up> <up> <up> f s 
<C-home> <down> <down> <down> f <C-end> <up> <up> <up> 
<up> <up> <up> <up> <up> C-SPC <down> <down> <down> 
<down> C-w C-y C-x o C-y <up> C-x C-e C-x o C-e C-x 
C-e <C-prior> <return> C-x C-f <backspace> <return> 
g C-x 1 f C-x C-s C-x k <return> g <down> <down> <down> 
f C-x v v C-c C-a C-c C-a C-c C-c <C-f12> <return> 
M-x e m a c s SPC s u <tab> C-h a b u g <return> C-x 
o C-s s u b m i t C-s C-s C-s C-s C-s C-s C-s <home> 
<next> <next> <next> <next> <prior> <home> C-s e m 
a c s - b C-s C-x o M-x r e p o r t SPC e m <tab> <return> 
w i s h : SPC i n c l u c <backspace> d e SPC <f10> 
<S-f1> <help-echo> <down-mouse-1> <mouse-1> C-g C-x 
C-x o C-x o C-x o C-g <backspace> C-x C-f s i <tab> 
v c <tab> <backspace> <backspace> v <tab> v c <tab> 
a <tab> <return> <next> <next> <next> <next> <next> 
<next> <next> <next> <down> <right> <right> <right> 
<right> <right> <right> <right> C-M-k C-y C-x o x M-x 
r e p o r <tab> <return>

Recent messages:
Loading apropos...done
Type C-x 1 to remove help window.  
Mark saved where search started
Mark set [2 times]
Mark saved where search started
Loading emacsbug...done
Quit
exchange-point-and-mark: No mark set in this buffer
Quit
Mark set
byte-code: Buffer is read-only: #<buffer *Apropos*>





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Tue, 29 Mar 2011 00:32:03 GMT) Full text and rfc822 format available.

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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Tue, 29 Mar 2011 00:45:02 GMT) Full text and rfc822 format available.

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

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Tue, 29 Mar 2011 02:43:49 +0200
On Mon, Mar 28, 2011 at 19:49, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> Juanma, feel free to install such a feature.

Hmm, no. It's just half-cooked; I threw it together in a few minutes
to help the OP.

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

Fist time I've heard of it ;-)

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

Even if the buffer contains the same version, there's the matter of
visual-line-mode, truncate-lines, etc. which can affect line count. So
yes, for a robust answer looking at the context seems essential.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Tue, 29 Mar 2011 03:33:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Mon, 28 Mar 2011 23:32:40 -0400
> Even if the buffer contains the same version, there's the matter of
> visual-line-mode, truncate-lines, etc. which can affect line count.

count-lines and goto-line only pays attention to hard newlines and are
unaffected by display settings, so that shouldn't be an issue.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Tue, 29 Mar 2011 09:17:03 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Tue, 29 Mar 2011 10:47:35 +0200
> 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).

I'm often in need for a general, customizable function for finding the
best match of some text in two different buffers.  For example, to get
from a texinfo to an info buffer and vice-versa.  Any advances in that
direction would be very appreciated.

martin





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Tue, 29 Mar 2011 13:53:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Tue, 29 Mar 2011 09:51:58 -0400
> I'm often in need for a general, customizable function for finding the
> best match of some text in two different buffers.  For example, to get
> from a texinfo to an info buffer and vice-versa.  Any advances in that
> direction would be very appreciated.

Damn!  And I thought you had this stashed in your window-pub branch!


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Tue, 29 Mar 2011 15:19:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, 8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Tue, 29 Mar 2011 17:18:13 +0200
>> I'm often in need for a general, customizable function for finding the
>> best match of some text in two different buffers.  For example, to get
>> from a texinfo to an info buffer and vice-versa.  Any advances in that
>> direction would be very appreciated.
>
> Damn!  And I thought you had this stashed in your window-pub branch!

I've stashed it somewhere else.  But it's far from perfect :-(

martin




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Sun, 24 Apr 2011 19:44:01 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Uwe Brauer <oub <at> mat.ucm.es>, Stefan Monnier <monnier <at> iro.umontreal.ca>,
	8366 <at> debbugs.gnu.org
Subject: Re: bug#8366: wish: include vc-annotate-goto-line
Date: Sun, 24 Apr 2011 15:43:34 -0400
Juanma Barranquero <lekktu <at> gmail.com> writes:

>> Juanma, feel free to install such a feature.
>
> Hmm, no. It's just half-cooked; I threw it together in a few minutes
> to help the OP.
>
>> 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).
>
> Even if the buffer contains the same version, there's the matter of
> visual-line-mode, truncate-lines, etc. which can affect line count. So
> yes, for a robust answer looking at the context seems essential.

A non-robust implementation is better than nothing, so I committed the
command to the trunk, starting from your version, and revising it to use
vc-parent-buffer and emitting warning messages if the parent file/buffer
is modified or out of date.

As for the "look for the closest line with the same text" functionality,
my feeling is that this is a mug's game when version control is
involved.  If you or anyone else wants to take a stab at it, feel free.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#8366; Package emacs. (Mon, 31 Jan 2022 16:48:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
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, 31 Jan 2022 17:46:56 +0100
Uwe Brauer <oub <at> mat.ucm.es> writes:

> some days ago Juanma Barranquero wrote a very useful function which allows 
> you to jump from the vc-annotate buffer to the corresponding point in the
> file which is under vc. 
>
> I strongly suggesto to include this function.
>
> (defun vc-annotate-goto-line ()
>   (interactive)

This was apparently added a week later:

commit 3ba7869ce8386d79d21f8e6f7d3c23088f9838ce
Author:     Chong Yidong <cyd <at> stupidchicken.com>
AuthorDate: Sun Apr 24 15:37:47 2011 -0400

    Add vc-annotate-goto-line.
    * vc/vc-annotate.el (vc-annotate-goto-line): New command.  Based
    on a previous implementation by Juanma Barranquero (Bug#8366).

So I'm therefore closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 8366 <at> debbugs.gnu.org and Uwe Brauer <oub <at> mat.ucm.es> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 31 Jan 2022 16:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Mar 2022 12:24:08 GMT) Full text and rfc822 format available.

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

Previous Next


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