Subject: bug#15418: 24.3.50; RCS annotate broken in vc-rcs.el r114131

From: Stefan Monnier <[email-masked]>
Date: Tue, 05 Nov 2013 10:37:56 -0500

> Attached is a simple RCS master file that reproduces the issue.

Thanks.  I installed the patch below which fixes the problem at least on
this trivial file.  And sorry for taking so long.  Please confirm that
it fixes the problem in real life as well.

        Stefan

=== modified file 'lisp/vc/vc-rcs.el'
--- lisp/vc/vc-rcs.el	2013-10-04 23:47:00 +0000
+++ lisp/vc/vc-rcs.el	2013-11-05 15:25:06 +0000
@@ -1355,18 +1354,18 @@
                                 (funcall proc)
                               (buffer-substring-no-properties b e))))
          (k-semi (name &optional proc) (tok+val #'to-semi name proc))
-         (gather () (let ((pairs `(,e ,@@-holes ,b))
+         (gather (b e @-holes)
+                 (let ((pairs `(,e ,@@-holes ,b))
                           acc)
                       (while pairs
                         (push (buffer-substring-no-properties
                                (cadr pairs) (car pairs))
                               acc)
                         (setq pairs (cddr pairs)))
-                      (apply 'concat acc)))
-         (k-one@ (name &optional later) (tok+val #'to-one@ name
-                                                 (if later
-                                                     (lambda () t)
-                                                   #'gather))))
+                   (apply #'concat acc)))
+         (gather1 () (gather b e @-holes))
+         (k-one@ (name &optional later)
+                 (tok+val #'to-one@ name (if later (lambda () t) #'gather1))))
       (save-excursion
         (goto-char (point-min))
         ;; headers
@@ -1444,9 +1443,10 @@
               ;; 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 ((b beg) (e end) @-holes)
                             (while (and asc (< (car asc) e))
+                              (push (pop asc) @-holes)
                               (push (pop asc) @-holes))
                             ;; Self-deprecate when work is done.
                             ;; Folding many dimensions into one.
@@ -1454,7 +1454,7 @@
                             ;; O beauteous math! --the Unvexed Bum
                             (unless asc
                               (setq sub #'buffer-substring-no-properties))
-                            (gather))))
+                            (gather b e @-holes))))
             (while (and (sw)
                         (not (eobp))
                         (setq context (to-eol)
@@ -1470,7 +1470,7 @@
               ;; other revisions, replace the `text' tag+value with `:insn'
               ;; plus value, always scanning in-place.
               (if (string= context (cdr (assq 'head headers)))
-                  (setcdr (cadr rev) (gather))
+                  (setcdr (cadr rev) (gather b e @-holes))
                 (if @-holes
                     (setq asc (nreverse @-holes)
                           sub #'incg)