Subject: bug#7088: `copy-tree' of a vector copy sharing structure.with original

From: David De La Harpe Golden <[email-masked]>
Date: Thu, 23 Sep 2010 21:41:30 +0100

On 23/09/10 06:28, MON KEY wrote:
> (let ((orig [[a b] [c d] [e f] [g h]])
>        new-cp)
>    (setq new-cp (copy-tree orig))

Some people would have at least considered a quick C-h f copy-tree
before filing a bug?

You're missing the VECP arg to emacs lisp copy-tree.

Without that, emacs lisp copy-tree is, much like common lisp copy-tree, 
documented to copy trees of _conses_.   Conses do of course look pretty 
like 2 element vectors, but they are a separate datatype in emacs lisp.

ELISP> (let ((orig [[a b] [c d] [e f] [g h]])
       new-cp)
   (setq new-cp (copy-tree orig t))
   (string-equal (aref (prog1 orig
                         (aset new-cp 0 "bubba"))
                       0)
                 "bubba"))
*** Eval error ***  Wrong type argument: stringp, [a b]