From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#15418: 24.3.50; RCS annotate broken in vc-rcs.el r114131 Date: Thu, 19 Sep 2013 17:26:06 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: ger.gmane.org 1380057144 21068 80.91.229.3 (24 Sep 2013 21:12:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Sep 2013 21:12:24 +0000 (UTC) Cc: 15418@debbugs.gnu.org To: Richard Copley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 24 23:12:25 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VOZuD-0003NZ-3y for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Sep 2013 23:12:25 +0200 Original-Received: from localhost ([::1]:48244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOZuC-00028W-Kf for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Sep 2013 17:12:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOZtz-00021f-7B for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2013 17:12:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOZtr-0003Y1-AO for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2013 17:12:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOZtr-0003Xx-6b for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2013 17:12:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VOZtq-0001ER-VG for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2013 17:12:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Sep 2013 21:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15418 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15418-submit@debbugs.gnu.org id=B15418.13800570714655 (code B ref 15418); Tue, 24 Sep 2013 21:12:02 +0000 Original-Received: (at 15418) by debbugs.gnu.org; 24 Sep 2013 21:11:11 +0000 Original-Received: from localhost ([127.0.0.1]:33311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOZt0-0001Cz-Fb for submit@debbugs.gnu.org; Tue, 24 Sep 2013 17:11:10 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:24739) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VOZsx-0001Cl-GB for 15418@debbugs.gnu.org; Tue, 24 Sep 2013 17:11:08 -0400 Original-Received: from ceviche.home ([24.201.53.56]) by VL-VM-MR006.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MTN00KYZEUH1U20@VL-VM-MR006.ip.videotron.ca> for 15418@debbugs.gnu.org; Tue, 24 Sep 2013 17:11:06 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id 212AF6650F; Thu, 19 Sep 2013 17:26:06 -0400 (EDT) In-reply-to: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78718 Archived-At: >>>>> "Richard" == Richard Copley 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)