]> git.eshelyaron.com Git - emacs.git/commitdiff
safe-copy-tree. Correct mistakes from earlier patch.
authorAlan Mackenzie <acm@muc.de>
Tue, 7 Mar 2023 15:26:20 +0000 (15:26 +0000)
committerAlan Mackenzie <acm@muc.de>
Tue, 7 Mar 2023 15:26:20 +0000 (15:26 +0000)
* lisp/emacs-lisp/bytecomp.el (compile-defun): Remove unintended change.

* lisp/subr.el (safe-copy-tree--seen): Correct grammatical error in doc
string.
(safe-copy-tree): Delete hash table at end of function.

* doc/lispref/lists.texi (Building Lists): Add an "@end defun" line.

doc/lispref/lists.texi
lisp/emacs-lisp/bytecomp.el
lisp/subr.el

index 911defbc211077886a00650b7197f01a54dc4989..3478049c84fd2ca35124093e165325998be47295 100644 (file)
@@ -719,6 +719,7 @@ Normally, when @var{tree} is anything other than a cons cell,
 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,
index 243d4b11b5f2edbe07d78acf7001c32c155f8c4e..12850c27b887946c4737b6c057bed44faf996c2b 100644 (file)
@@ -2294,19 +2294,12 @@ With argument ARG, insert value in current buffer after the form."
            (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.")
index 2066be581d13437832e9767a7c709c26af496218..e29c8ddd6c448131c8f854d05af6a230b310969f 100644 (file)
@@ -848,8 +848,8 @@ argument VECP, this copies vectors as well as conses."
 
 (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.
@@ -896,7 +896,10 @@ If TREE is a cons cell, this recursively copies both its car and its cdr.
 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.