[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix for navigation bug in vc-annotate-mode

From: Benjamin Rutt
Subject: fix for navigation bug in vc-annotate-mode
Date: Fri, 08 Oct 2004 21:51:44 -0400
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Early this year, I submitted some changes to vc.el and vc-cvs.el to
enhance navigation of vc-annotate buffers (going backwards and
forwards in revisions, and jumping to diffs and changelogs of the
revision of the current line).

I now realize that there is a bug remaining in this change; if you do
the following:

1) 'C-x v g' when visiting a file under CVS control
2) 'C-x o' to select the annotate buffer
3) access menu option 'VC-Annotate'->'Span 34.0 days'
4) press 'P' to go back a version

#4 fails because the function `vc-annotate-display-select'
unconditionally calls vc-annotate-mode, which kills all local
variables, which the 'P' and 'N' navigation depends on.  The problem
is, the variable `vc-annotate-mode' is never set to non-nil, so
therefore the `vc-annotate-display-select' function was always
calling it, which killed the value of `vc-annotate-parent-rev'.

The patch below fixes this problem, and this time only initializes
this mode if it isn't already activated, thus preserving the local
variables.  Also the unused `vc-annotate-mode' variable is removed.
If there are no objections, can someone commit this?  Thank you.

Changelog patch follows the patch.

Index: vc.el
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.377
diff -c -r1.377 vc.el
*** vc.el       23 Apr 2004 21:02:23 -0000      1.377
--- vc.el       9 Oct 2004 01:32:51 -0000
*** 645,653 ****
    :group 'vc)
  ;; vc-annotate functionality (CVS only).
- (defvar vc-annotate-mode nil
-   "Variable indicating if VC-Annotate mode is active.")
  (defvar vc-annotate-mode-map
    (let ((m (make-sparse-keymap)))
      (define-key m [menu-bar] (make-sparse-keymap "VC-Annotate"))
--- 645,650 ----
*** 2996,3002 ****
    (when buffer
      (set-buffer buffer)
      (display-buffer buffer))
!   (if (not vc-annotate-mode)          ; Turn on vc-annotate-mode if not done
    (cond ((null vc-annotate-display-mode)
         (vc-annotate-display-default vc-annotate-ratio))
--- 2993,2999 ----
    (when buffer
      (set-buffer buffer)
      (display-buffer buffer))
!   (if (not vc-annotate-parent-rev)
    (cond ((null vc-annotate-display-mode)
         (vc-annotate-display-default vc-annotate-ratio))

Index: ChangeLog
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.6214
diff -c -r1.6214 ChangeLog
*** ChangeLog   4 Jul 2004 23:41:41 -0000       1.6214
--- ChangeLog   9 Oct 2004 01:45:08 -0000
*** 1,3 ****
--- 1,8 ----
+ 2004-10-08  Benjamin Rutt  <address@hidden>
+         * vc.el (vc-annotate-display-select): Only call vc-annotate-mode
+         if we're not in that mode already.  (vc-annotate-mode):  Remove.
  2004-07-05  Kenichi Handa  <address@hidden>
        * international/mule.el (decode-coding-inserted-region): Set

reply via email to

[Prev in Thread] Current Thread [Next in Thread]