GNU bug report logs - #15418
24.3.50; RCS annotate broken in vc-rcs.el r114131

Previous Next

Package: emacs;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Thu, 19 Sep 2013 14:18:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Richard Copley <rcopley <at> gmail.com>
Cc: 15418 <at> debbugs.gnu.org
Subject: Re: bug#15418: 24.3.50; RCS annotate broken in vc-rcs.el r114131
Date: Thu, 19 Sep 2013 17:26:06 -0400
>>>>> "Richard" == Richard Copley <rcopley <at> gmail.com> writes:

> For some files under RCS version control, `vc-annotate' now fails with
> error `(wrong-type-argument integer-or-marker-p nil)'.

> I think the problem is with the variable `b' whose dynamic binding
> was used by `gather' and set by `incg' (local functions in
> `vc-rcs-parse'), prior to r114131.

Indeed, it seems like there was some subtle dynamic scoping at play.
Does the patch below fix your problem?


        Stefan


=== modified file 'lisp/vc/vc-rcs.el'
--- lisp/vc/vc-rcs.el	2013-09-04 21:09:42 +0000
+++ lisp/vc/vc-rcs.el	2013-09-19 21:24:53 +0000
@@ -1234,6 +1234,8 @@
   (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-b" branch))
   (vc-file-setprop file 'vc-rcs-default-branch branch))
 
+(defvar vc-rcs--b)
+
 (defun vc-rcs-parse (&optional buffer)
   "Parse current buffer, presumed to be in RCS-style masterfile format.
 Optional arg BUFFER specifies another buffer to parse.  Return an alist
@@ -1314,7 +1316,7 @@
         tok
         ;; Region (begin and end buffer positions) of the printed
         ;; representation for the current tag.
-        b e
+        vc-rcs--b e
         ;; A list of buffer positions where "@@" can be found within the
         ;; printed representation region.  For each location, we push two
         ;; elements onto the list, 1+ and 2+ the location, respectively,
@@ -1330,11 +1332,11 @@
          (to-eol () (buffer-substring-no-properties
                      (point) (progn (forward-line 1)
                                     (1- (point)))))
-         (to-semi () (setq b (point)
+         (to-semi () (setq vc-rcs--b (point)
                            e (progn (search-forward ";")
                                     (1- (point)))))
          (to-one@ () (setq @-holes nil
-                           b (progn (search-forward "@") (point))
+                           vc-rcs--b (progn (search-forward "@") (point))
                            e (progn (while (and (search-forward "@")
                                                 (= ?@ (char-after))
                                                 (progn
@@ -1349,9 +1351,9 @@
                   (funcall set-b+e)
                   (cons tok (if proc
                                 (funcall proc)
-                              (buffer-substring-no-properties b e))))
+                              (buffer-substring-no-properties vc-rcs--b e))))
          (k-semi (name &optional proc) (tok+val #'to-semi name proc))
-         (gather () (let ((pairs `(,e ,@@-holes ,b))
+         (gather () (let ((pairs `(,e ,@@-holes ,vc-rcs--b))
                           acc)
                       (while pairs
                         (push (buffer-substring-no-properties
@@ -1381,7 +1383,7 @@
                                (setcdr two (cadr two))
                                two))
                            (split-string
-                            (buffer-substring-no-properties b e)))))
+                            (buffer-substring-no-properties vc-rcs--b e)))))
           (hpush 'locks))
         (push `(strict . ,(when (at 'strict)
                             (search-forward ";")
@@ -1403,7 +1405,7 @@
                              (let ((ls (mapcar 'string-to-number
                                                (split-string
                                                 (buffer-substring-no-properties
-                                                 b e)
+                                                 vc-rcs--b e)
                                                 "\\."))))
                                ;; Hack the year -- verified to be the
                                ;; same algorithm used in RCS 5.7.
@@ -1414,7 +1416,7 @@
                   ,(k-semi 'branches
                            (lambda ()
                              (split-string
-                              (buffer-substring-no-properties b e))))
+                              (buffer-substring-no-properties vc-rcs--b e))))
                   ,(k-semi 'next))
                 revs)
           (sw))
@@ -1440,8 +1442,8 @@
               ;; only the former since it behaves identically to the
               ;; latter in the absence of "@@".)
               sub)
-          (cl-flet ((incg (_beg end)
-                          (let ((e end) @-holes)
+          (cl-flet ((incg (beg end)
+                          (let ((vc-rcs--b beg) (e end) @-holes)
                             (while (and asc (< (car asc) e))
                               (push (pop asc) @-holes))
                             ;; Self-deprecate when work is done.
@@ -1471,7 +1473,7 @@
                     (setq asc (nreverse @-holes)
                           sub #'incg)
                   (setq sub #'buffer-substring-no-properties))
-                (goto-char b)
+                (goto-char vc-rcs--b)
                 (setq acc nil)
                 (while (< (point) e)
                   (forward-char 1)





This bug report was last modified 11 years and 205 days ago.

Previous Next


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