|
From: | Kevin Rodgers |
Subject: | Re: vc.el - Implementation of cvs admin -mrev:message file |
Date: | Mon, 16 Aug 2004 09:34:14 -0600 |
User-agent: | Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Sandip Chitale wrote: > (defun vc-cvs-version-list (file) > "Return list of versions for FILE." > (let (versions) > (with-temp-buffer > (vc-do-command t 0 "cvs" file "log" "-N") > (goto-char (point-min)) > (while (re-search-forward "^revision \\([0-9.]+\\)" nil t) > (append-to-list 'versions (list (cons (match-string 1) nil))) > (goto-char (match-end 0)))) > versions)) The usual lisp idiom for constructing a list like that is to push each element on the front and then destructively reverse it. The idea is to avoid unnecessary cons'ing with append and unnecessary list traversal with append or nconc. (defun vc-cvs-version-list (file) "Return list of versions for FILE." (let (versions) (with-temp-buffer (vc-do-command t 0 "cvs" file "log" "-N") (goto-char (point-min)) (while (re-search-forward "^revision \\([0-9.]+\\)" nil t) (setq versions (cons (match-string 1) version)))) (nreverse versions))) -- Kevin Rodgers
[Prev in Thread] | Current Thread | [Next in Thread] |