Subject: bug#901: [PATCH] 23.0.60; "l" in "annotation" buffer does nothing

From: Eric Hanchrow <[email-masked]>
Date: Fri, 05 Sep 2008 21:58:29 -0700

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I visited a file that is in a git working tree, then typed C-x v g to
display annotations.  I put point at the beginning of some line in that
buffer, and typed "l".  I expected to see point move the the line in
*vc-change-log* whose commit matches that displayed in the *Annotate
... buffer, but instead it just stays on the second commit.

This patch fixes it for me.

 lisp/vc-git.el |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 7946624..f54048e 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -491,12 +491,13 @@
 REVISION may have the form BRANCH, BRANCH~N,
 or BRANCH^ (where \"^\" can be repeated)."
   (goto-char (point-min))
-  (search-forward "\ncommit" nil t
-                  (cond ((string-match "~\\([0-9]\\)$" revision)
-                         (1+ (string-to-number (match-string 1 revision))))
-                        ((string-match "\\^+$" revision)
-                         (1+ (length (match-string 0 revision))))
-                        (t nil)))
+  (let ((count (cond ((string-match "~\\([0-9]\\)$" revision)
+                      (1+ (string-to-number (match-string 1 revision))))
+                     ((string-match "\\^+$" revision)
+                      (1+ (length (match-string 0 revision))))
+                     (t nil))))
+    (let ((sought (if count "\ncommit" (format "\ncommit %s" revision))))
+      (search-forward sought nil t count)))
   (beginning-of-line))
 
 (defun vc-git-diff (files &optional rev1 rev2 buffer)
-- 
1.6.0.1.216.g1b23a

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/src/emacs-via-git/etc/DEBUG for instructions.

In GNU Emacs 23.0.60.16 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2008-09-05 on debian
configured using `configure  '--enable-maintainer-mode' '--with-xpm=yes' '--with-jpeg=no' '--with-gif=no' '--with-tiff=no' '--with-xft' '--with-x-toolkit=gtk''

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: nil
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Diff

Minor modes in effect:
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-netsplit-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-log-mode: t
  erc-services-mode: t
  erc-networks-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-readonly-mode: t
  desktop-save-mode: t
  recentf-mode: t
  display-time-mode: t
  global-auto-revert-mode: t
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  iswitchb-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x o C-n C-n l C-x 0 C-x b s h e RET c SPC / u s r 
C-a ESC f d C-e / l o c TAB s r TAB e m TAB RET g i 
t SPC l o g SPC - 3 SPC - - n o - m e r g e s RET C-c 
C-p C-n ESC C-b ESC C-@ ESC w ESC > g o t SPC DEL DEL 
DEL g i DEL DEL i t SPC f o r m a t - p a t c h SPC 
C-y RET C-x d RET g C-u C-n d d d d d d d d d d d d 
d d x y e s RET q ESC x w o m a n RET g i t - f o r 
TAB m TAB RET C-v q ESC p . . RET ESC p H E A D RET 
C-x RET g C-x d RET g C-p C-p C-p C-p d d d d x y e 
s RET q ESC p ESC DEL ESC b . . C-e DEL DEL RET ESC 
p ^ RET ESC p DEL ESC C-b DEL DEL C-e C-c C-p C-n C-e 
C-@ C-g SPC - 1 RET C-p ESC x f f a p RET RET C-x C-q 
n n p p q ESC > C-x b RET C-x k RET C-x 2 C-x b C-r 
C-r C-r C-r RET ESC < C-s s i g n C-x o ESC p SPC - 
s RET C-p ESC x f f a p RET RET y e s RET C-x 1 n n 
C-x u C-x C-q n p ESC 0 C-l ESC x r e p o r t - e m 
TAB RET

Recent messages:
4 of 4 deletions
4 deletions done
History item: 1 [3 times]
Mark set
Quit
diff-hunk-prev: No previous hunk
Mark set [2 times]
Mark saved where search started
History item: 1
Undo!

-- 
The whole point of loud music is to make it possible
to date without talking.
        -- Roger Ebert