emacs-diffs
[Top][All Lists]

## [Emacs-diffs] Changes to emacs/lisp/subr.el

 From: Miles Bader Subject: [Emacs-diffs] Changes to emacs/lisp/subr.el Date: Tue, 11 Jun 2002 21:53:21 -0400

```Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.306 emacs/lisp/subr.el:1.307
*** emacs/lisp/subr.el:1.306    Sat Jun  8 16:48:15 2002
--- emacs/lisp/subr.el  Mon Jun 10 05:01:08 2002
***************
*** 191,222 ****
(delq elt (copy-sequence list))
list))

- (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 copy-tree (tree &optional vecp)
"Make a copy of TREE.
If TREE is a cons cell, this recursively copies both its car and its cdr.
! Contrast to copy-sequence, which copies only along the cdrs.  With second
argument VECP, this copies vectors as well as conses."
(if (consp tree)
!       (let ((p (setq tree (copy-list tree))))
!       (while (consp p)
!         (if (or (consp (car p)) (and vecp (vectorp (car p))))
!             (setcar p (copy-tree (car p) vecp)))
!         (or (listp (cdr p)) (setcdr p (copy-tree (cdr p) vecp)))
!         (cl-pop p)))
(if (and vecp (vectorp tree))
(let ((i (length (setq tree (copy-sequence tree)))))
(while (>= (setq i (1- i)) 0)
!           (aset tree i (copy-tree (aref tree i) vecp))))))
!   tree)

(defun assoc-default (key alist &optional test default)
"Find object KEY in a pseudo-alist ALIST.
--- 191,216 ----
(delq elt (copy-sequence list))
list))

(defun copy-tree (tree &optional vecp)
"Make a copy of TREE.
If TREE is a cons cell, this recursively copies both its car and its cdr.
! Contrast to `copy-sequence', which copies only along the cdrs.  With second
argument VECP, this copies vectors as well as conses."
(if (consp tree)
!       (let (result)
!       (while (consp tree)
!         (let ((newcar (car tree)))
!           (if (or (consp (car tree)) (and vecp (vectorp (car tree))))
!               (setq newcar (copy-tree (car tree) vecp)))
!           (push newcar result))
!         (setq tree (cdr tree)))
!       (nreconc result tree))
(if (and vecp (vectorp tree))
(let ((i (length (setq tree (copy-sequence tree)))))
(while (>= (setq i (1- i)) 0)
!           (aset tree i (copy-tree (aref tree i) vecp)))
!         tree)
!       tree)))

(defun assoc-default (key alist &optional test default)
"Find object KEY in a pseudo-alist ALIST.

```