Function: compat--copy-tree
compat--copy-tree is a byte-compiled function defined in compat-30.el.
Signature
(compat--copy-tree TREE &optional VECTORS-AND-RECORDS)
Documentation
[Compatibility function for copy-tree, defined in Emacs 30.1. See (compat)
Emacs 30.1' for more details.]
Handle copying records when optional arg is non-nil.
Source Code
;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-30.el
(compat-defun copy-tree (tree &optional vectors-and-records) ;; <compat-tests:copy-tree>
"Handle copying records when optional arg is non-nil."
:extended t
(declare (side-effect-free error-free))
(if (fboundp 'recordp)
(if (consp tree)
(let (result)
(while (consp tree)
(let ((newcar (car tree)))
(if (or (consp (car tree))
(and vectors-and-records
(or (vectorp (car tree)) (recordp (car tree)))))
(setq newcar (compat--copy-tree (car tree) vectors-and-records)))
(push newcar result))
(setq tree (cdr tree)))
(nconc (nreverse result)
(if (and vectors-and-records (or (vectorp tree) (recordp tree)))
(compat--copy-tree tree vectors-and-records)
tree)))
(if (and vectors-and-records (or (vectorp tree) (recordp tree)))
(let ((i (length (setq tree (copy-sequence tree)))))
(while (>= (setq i (1- i)) 0)
(aset tree i (compat--copy-tree (aref tree i) vectors-and-records)))
tree)
tree))
(copy-tree tree vectors-and-records)))