changeset 45739:af30a5644ebc

(copy-list): Moved back from subr.el.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 Jun 2002 09:00:52 +0000
parents 12bd288850ef
children 4e576724db9f
files lisp/emacs-lisp/cl.el
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/cl.el	Mon Jun 10 08:50:02 2002 +0000
+++ b/lisp/emacs-lisp/cl.el	Mon Jun 10 09:00:52 2002 +0000
@@ -514,6 +514,15 @@
       (push (pop list) res))
     (nreverse res)))
 
+(defun copy-list (list)
+  "Return a copy of a list, which may be a dotted list.
+The elements of the list are not copied, just the list structure itself."
+  (if (consp list)
+      (let ((res nil))
+	(while (consp list) (push (pop list) res))
+	(prog1 (nreverse res) (setcdr res list)))
+    (car list)))
+
 (defun cl-maclisp-member (item list)
   (while (and list (not (equal item (car list)))) (setq list (cdr list)))
   list)