non-@code{nil}, it copies vectors and records too (and operates
recursively on their elements). This function handles circular lists
and vectors, and is thus slower than @code{copy-tree} for typical cases.
+@end defun
@defun flatten-tree tree
This function returns a ``flattened'' copy of @var{tree}, that is,
(symbols-with-pos-enabled t)
(value (eval
(displaying-byte-compile-warnings
-;;;; NEW STOUGH, 2023-03-05
- (byte-run-strip-symbol-positions
-;;;; END OF NEW STOUGH
(byte-compile-sexp
(let ((form (read-positioning-symbols (current-buffer))))
(push form byte-compile-form-stack)
(eval-sexp-add-defvars
form
- start-read-position)))
-;;;; NEW STOUGH, 2023-03-05
- )
-;;;; END OF NEW STOUGH
- )
+ start-read-position))))
lexical-binding)))
(cond (arg
(message "Compiling from buffer... done.")
(defvar safe-copy-tree--seen nil
"A hash table for conses/vectors/records already seen by safe-copy-tree-1.
-It's key is a cons or vector/record seen by the algorithm, and its value is
-the corresponding cons/vector/record in the copy.")
+Its key is a cons or vector/record seen by the algorithm, and its
+value is the corresponding cons/vector/record in the copy.")
(defun safe-copy-tree--1 (tree &optional vecp)
"Make a copy of TREE, taking circular structure into account.
Contrast to `copy-sequence', which copies only along the cdrs. With second
argument VECP, this copies vectors and records as well as conses."
(setq safe-copy-tree--seen (make-hash-table :test #'eq))
- (safe-copy-tree--1 tree vecp))
+ (unwind-protect
+ (safe-copy-tree--1 tree vecp)
+ (clrhash safe-copy-tree--seen)
+ (setq safe-copy-tree--seen nil)))
\f
;;;; Various list-search functions.