diff options
| author | Richard M. Stallman | 2002-06-10 08:33:13 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-06-10 08:33:13 +0000 |
| commit | a9304a86df1fdcd59e88cf773a0238418b3fddd0 (patch) | |
| tree | 48895a2004561e06f89777cf7ea2d15d237537f2 | |
| parent | 48e889be9af0f7ad425237758b5beaa7c8747bf8 (diff) | |
| download | emacs-a9304a86df1fdcd59e88cf773a0238418b3fddd0.tar.gz emacs-a9304a86df1fdcd59e88cf773a0238418b3fddd0.zip | |
(eshell-copy-list): Function deleted.
(eshell-sublist, eshell-copy-tree): Use copy-sequence.
| -rw-r--r-- | lisp/eshell/esh-util.el | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 26de0a55eef..c73d0940200 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -236,7 +236,7 @@ then quoting is done by a backslash, rather than a doubled delimiter." | |||
| 236 | (defun eshell-sublist (l &optional n m) | 236 | (defun eshell-sublist (l &optional n m) |
| 237 | "Return from LIST the N to M elements. | 237 | "Return from LIST the N to M elements. |
| 238 | If N or M is nil, it means the end of the list." | 238 | If N or M is nil, it means the end of the list." |
| 239 | (let* ((a (eshell-copy-list l)) | 239 | (let* ((a (copy-sequence l)) |
| 240 | result) | 240 | result) |
| 241 | (if (and m (consp (nthcdr m a))) | 241 | (if (and m (consp (nthcdr m a))) |
| 242 | (setcdr (nthcdr m a) nil)) | 242 | (setcdr (nthcdr m a) nil)) |
| @@ -710,22 +710,13 @@ Unless optional argument INPLACE is non-nil, return a new string." | |||
| 710 | (setq entry nil))))))) | 710 | (setq entry nil))))))) |
| 711 | (or entry (funcall handler 'file-attributes file))))) | 711 | (or entry (funcall handler 'file-attributes file))))) |
| 712 | 712 | ||
| 713 | (defun eshell-copy-list (list) | ||
| 714 | "Return a copy of a list, which may be a dotted list. | ||
| 715 | The elements of the list are not copied, just the list structure itself." | ||
| 716 | (if (consp list) | ||
| 717 | (let ((res nil)) | ||
| 718 | (while (consp list) (push (pop list) res)) | ||
| 719 | (prog1 (nreverse res) (setcdr res list))) | ||
| 720 | (car list))) | ||
| 721 | |||
| 722 | (defun eshell-copy-tree (tree &optional vecp) | 713 | (defun eshell-copy-tree (tree &optional vecp) |
| 723 | "Make a copy of TREE. | 714 | "Make a copy of TREE. |
| 724 | If TREE is a cons cell, this recursively copies both its car and its cdr. | 715 | If TREE is a cons cell, this recursively copies both its car and its cdr. |
| 725 | Contrast to copy-sequence, which copies only along the cdrs. With second | 716 | Contrast to copy-sequence, which copies only along the cdrs. With second |
| 726 | argument VECP, this copies vectors as well as conses." | 717 | argument VECP, this copies vectors as well as conses." |
| 727 | (if (consp tree) | 718 | (if (consp tree) |
| 728 | (let ((p (setq tree (eshell-copy-list tree)))) | 719 | (let ((p (setq tree (copy-sequence tree)))) |
| 729 | (while (consp p) | 720 | (while (consp p) |
| 730 | (if (or (consp (car p)) (and vecp (vectorp (car p)))) | 721 | (if (or (consp (car p)) (and vecp (vectorp (car p)))) |
| 731 | (setcar p (eshell-copy-tree (car p) vecp))) | 722 | (setcar p (eshell-copy-tree (car p) vecp))) |