all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Richard Copley <rcopley@gmail.com>
Cc: 15418@debbugs.gnu.org
Subject: bug#15418: 24.3.50; RCS annotate broken in vc-rcs.el r114131
Date: Thu, 19 Sep 2013 17:26:06 -0400	[thread overview]
Message-ID: <jwvob7otsgh.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CAPM58oh4AHBpmYj8GfspqYLsd=zBYmXbCWpzu6fVOYwrsKEq2Q@mail.gmail.com>

>>>>> "Richard" == Richard Copley <rcopley@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)






  reply	other threads:[~2013-09-19 21:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 14:16 bug#15418: 24.3.50; RCS annotate broken in vc-rcs.el r114131 Richard Copley
2013-09-19 21:26 ` Stefan Monnier [this message]
2013-09-24 22:47   ` Richard Copley
2013-09-25  0:55     ` Stefan Monnier
2013-09-25  7:08       ` Richard Copley
2013-10-14 16:14         ` Richard Copley
2013-10-14 22:33           ` Richard Copley
2013-10-15 21:09             ` Richard Copley
2013-10-16  3:05           ` Stefan Monnier
2013-11-05 10:09             ` Richard Copley
2013-11-05 15:37           ` Stefan Monnier
2013-11-06 10:56             ` Richard Copley
2013-11-06 11:19               ` Richard Copley
2013-11-06 13:46                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvob7otsgh.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=15418@debbugs.gnu.org \
    --cc=rcopley@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.