/[emacs]/emacs/lisp/eshell/esh-util.el
ViewVC logotype

Diff of /emacs/lisp/eshell/esh-util.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by pj, Sun Jul 15 19:53:53 2001 UTC revision 1.15 by rms, Mon Jun 10 08:33:13 2002 UTC
# Line 236  then quoting is done by a backslash, rat Line 236  then quoting is done by a backslash, rat
236  (defun eshell-sublist (l &optional n m)  (defun eshell-sublist (l &optional n m)
237    "Return from LIST the N to M elements.    "Return from LIST the N to M elements.
238  If N or M is nil, it means the end of the list."  If N or M is nil, it means the end of the list."
239    (let* ((a (eshell-copy-list l))    (let* ((a (copy-sequence l))
240           result)           result)
241      (if (and m (consp (nthcdr m a)))      (if (and m (consp (nthcdr m a)))
242          (setcdr (nthcdr m a) nil))          (setcdr (nthcdr m a) nil))
# Line 710  Unless optional argument INPLACE is non- Line 710  Unless optional argument INPLACE is non-
710                        (setq entry nil)))))))                        (setq entry nil)))))))
711        (or entry (funcall handler 'file-attributes file)))))        (or entry (funcall handler 'file-attributes file)))))
712    
 (defun eshell-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)))  
   
713  (defun eshell-copy-tree (tree &optional vecp)  (defun eshell-copy-tree (tree &optional vecp)
714    "Make a copy of TREE.    "Make a copy of TREE.
715  If TREE is a cons cell, this recursively copies both its car and its cdr.  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  Contrast to copy-sequence, which copies only along the cdrs.  With second
717  argument VECP, this copies vectors as well as conses."  argument VECP, this copies vectors as well as conses."
718    (if (consp tree)    (if (consp tree)
719        (let ((p (setq tree (eshell-copy-list tree))))        (let ((p (setq tree (copy-sequence tree))))
720          (while (consp p)          (while (consp p)
721            (if (or (consp (car p)) (and vecp (vectorp (car p))))            (if (or (consp (car p)) (and vecp (vectorp (car p))))
722                (setcar p (eshell-copy-tree (car p) vecp)))                (setcar p (eshell-copy-tree (car p) vecp)))

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26