comparison lisp/eshell/esh-util.el @ 45741:b2a7c08cddcf

(eshell-copy-tree): Make it an alias for copy-tree.
author Richard M. Stallman <rms@gnu.org>
date Mon, 10 Jun 2002 09:02:54 +0000
parents fa968fe464d3
children 543b32b4673d
comparison
equal deleted inserted replaced
45740:4e576724db9f 45741:b2a7c08cddcf
708 (if fentry 708 (if fentry
709 (setq entry (cdr fentry)) 709 (setq entry (cdr fentry))
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-tree (tree &optional vecp) 713 (defalias 'eshell-copy-tree 'copy-tree)
714 "Make a copy of TREE.
715 If TREE is a cons cell, this recursively copies both its car and its cdr.
716 Contrast to copy-sequence, which copies only along the cdrs. With second
717 argument VECP, this copies vectors as well as conses."
718 (if (consp tree)
719 (let ((p (setq tree (copy-sequence tree))))
720 (while (consp p)
721 (if (or (consp (car p)) (and vecp (vectorp (car p))))
722 (setcar p (eshell-copy-tree (car p) vecp)))
723 (or (listp (cdr p)) (setcdr p (eshell-copy-tree (cdr p) vecp)))
724 (cl-pop p)))
725 (if (and vecp (vectorp tree))
726 (let ((i (length (setq tree (copy-sequence tree)))))
727 (while (>= (setq i (1- i)) 0)
728 (aset tree i (eshell-copy-tree (aref tree i) vecp))))))
729 tree)
730 714
731 (defsubst eshell-processp (proc) 715 (defsubst eshell-processp (proc)
732 "If the `processp' function does not exist, PROC is not a process." 716 "If the `processp' function does not exist, PROC is not a process."
733 (and (fboundp 'processp) (processp proc))) 717 (and (fboundp 'processp) (processp proc)))
734 718