Subject: wish: include vc-annotate-goto-line

From: Uwe Brauer <[email-masked]>
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*>