1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00

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.
This commit is contained in:
Alan Mackenzie 2023-03-07 15:26:20 +00:00
parent fa83b23611
commit 29f65920fb
3 changed files with 8 additions and 11 deletions

View 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 non-@code{nil}, it copies vectors and records too (and operates
recursively on their elements). This function handles circular lists recursively on their elements). This function handles circular lists
and vectors, and is thus slower than @code{copy-tree} for typical cases. and vectors, and is thus slower than @code{copy-tree} for typical cases.
@end defun
@defun flatten-tree tree @defun flatten-tree tree
This function returns a ``flattened'' copy of @var{tree}, that is, This function returns a ``flattened'' copy of @var{tree}, that is,

View file

@ -2294,19 +2294,12 @@ With argument ARG, insert value in current buffer after the form."
(symbols-with-pos-enabled t) (symbols-with-pos-enabled t)
(value (eval (value (eval
(displaying-byte-compile-warnings (displaying-byte-compile-warnings
;;;; NEW STOUGH, 2023-03-05
(byte-run-strip-symbol-positions
;;;; END OF NEW STOUGH
(byte-compile-sexp (byte-compile-sexp
(let ((form (read-positioning-symbols (current-buffer)))) (let ((form (read-positioning-symbols (current-buffer))))
(push form byte-compile-form-stack) (push form byte-compile-form-stack)
(eval-sexp-add-defvars (eval-sexp-add-defvars
form form
start-read-position))) start-read-position))))
;;;; NEW STOUGH, 2023-03-05
)
;;;; END OF NEW STOUGH
)
lexical-binding))) lexical-binding)))
(cond (arg (cond (arg
(message "Compiling from buffer... done.") (message "Compiling from buffer... done.")

View file

@ -848,8 +848,8 @@ argument VECP, this copies vectors as well as conses."
(defvar safe-copy-tree--seen nil (defvar safe-copy-tree--seen nil
"A hash table for conses/vectors/records already seen by safe-copy-tree-1. "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 Its key is a cons or vector/record seen by the algorithm, and its
the corresponding cons/vector/record in the copy.") value is the corresponding cons/vector/record in the copy.")
(defun safe-copy-tree--1 (tree &optional vecp) (defun safe-copy-tree--1 (tree &optional vecp)
"Make a copy of TREE, taking circular structure into account. "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 Contrast to `copy-sequence', which copies only along the cdrs. With second
argument VECP, this copies vectors and records as well as conses." argument VECP, this copies vectors and records as well as conses."
(setq safe-copy-tree--seen (make-hash-table :test #'eq)) (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)))
;;;; Various list-search functions. ;;;; Various list-search functions.