aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2023-03-07 15:26:20 +0000
committerAlan Mackenzie2023-03-07 15:26:20 +0000
commit29f65920fb49588dd4fa29b33e7ed024afc6ffb6 (patch)
tree93f825c77b08a24c3f07bd0717de9f6144f16475
parentfa83b236111ea024b75a8bb33b78a99f437a9a67 (diff)
downloademacs-29f65920fb49588dd4fa29b33e7ed024afc6ffb6.tar.gz
emacs-29f65920fb49588dd4fa29b33e7ed024afc6ffb6.zip
safe-copy-tree. Correct mistakes from earlier patch.
* 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.
-rw-r--r--doc/lispref/lists.texi1
-rw-r--r--lisp/emacs-lisp/bytecomp.el9
-rw-r--r--lisp/subr.el9
3 files changed, 8 insertions, 11 deletions
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 911defbc211..3478049c84f 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -719,6 +719,7 @@ Normally, when @var{tree} is anything other than a cons cell,
719non-@code{nil}, it copies vectors and records too (and operates 719non-@code{nil}, it copies vectors and records too (and operates
720recursively on their elements). This function handles circular lists 720recursively on their elements). This function handles circular lists
721and vectors, and is thus slower than @code{copy-tree} for typical cases. 721and vectors, and is thus slower than @code{copy-tree} for typical cases.
722@end defun
722 723
723@defun flatten-tree tree 724@defun flatten-tree tree
724This function returns a ``flattened'' copy of @var{tree}, that is, 725This function returns a ``flattened'' copy of @var{tree}, that is,
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 243d4b11b5f..12850c27b88 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2294,19 +2294,12 @@ With argument ARG, insert value in current buffer after the form."
2294 (symbols-with-pos-enabled t) 2294 (symbols-with-pos-enabled t)
2295 (value (eval 2295 (value (eval
2296 (displaying-byte-compile-warnings 2296 (displaying-byte-compile-warnings
2297;;;; NEW STOUGH, 2023-03-05
2298 (byte-run-strip-symbol-positions
2299;;;; END OF NEW STOUGH
2300 (byte-compile-sexp 2297 (byte-compile-sexp
2301 (let ((form (read-positioning-symbols (current-buffer)))) 2298 (let ((form (read-positioning-symbols (current-buffer))))
2302 (push form byte-compile-form-stack) 2299 (push form byte-compile-form-stack)
2303 (eval-sexp-add-defvars 2300 (eval-sexp-add-defvars
2304 form 2301 form
2305 start-read-position))) 2302 start-read-position))))
2306;;;; NEW STOUGH, 2023-03-05
2307 )
2308;;;; END OF NEW STOUGH
2309 )
2310 lexical-binding))) 2303 lexical-binding)))
2311 (cond (arg 2304 (cond (arg
2312 (message "Compiling from buffer... done.") 2305 (message "Compiling from buffer... done.")
diff --git a/lisp/subr.el b/lisp/subr.el
index 2066be581d1..e29c8ddd6c4 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -848,8 +848,8 @@ argument VECP, this copies vectors as well as conses."
848 848
849(defvar safe-copy-tree--seen nil 849(defvar safe-copy-tree--seen nil
850 "A hash table for conses/vectors/records already seen by safe-copy-tree-1. 850 "A hash table for conses/vectors/records already seen by safe-copy-tree-1.
851It's key is a cons or vector/record seen by the algorithm, and its value is 851Its key is a cons or vector/record seen by the algorithm, and its
852the corresponding cons/vector/record in the copy.") 852value is the corresponding cons/vector/record in the copy.")
853 853
854(defun safe-copy-tree--1 (tree &optional vecp) 854(defun safe-copy-tree--1 (tree &optional vecp)
855 "Make a copy of TREE, taking circular structure into account. 855 "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.
896Contrast to `copy-sequence', which copies only along the cdrs. With second 896Contrast to `copy-sequence', which copies only along the cdrs. With second
897argument VECP, this copies vectors and records as well as conses." 897argument VECP, this copies vectors and records as well as conses."
898 (setq safe-copy-tree--seen (make-hash-table :test #'eq)) 898 (setq safe-copy-tree--seen (make-hash-table :test #'eq))
899 (safe-copy-tree--1 tree vecp)) 899 (unwind-protect
900 (safe-copy-tree--1 tree vecp)
901 (clrhash safe-copy-tree--seen)
902 (setq safe-copy-tree--seen nil)))
900 903
901 904
902;;;; Various list-search functions. 905;;;; Various list-search functions.