From a20e119a0f60f85039726bf6ebcbe441060f9ef2 Mon Sep 17 00:00:00 2001 From: Joseph Turner Date: Sun, 14 May 2023 21:02:15 -0700 Subject: [PATCH] Make copy-tree work with records --- lisp/subr.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/subr.el b/lisp/subr.el index 03d3324f3d8..9573b19ae7e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -828,7 +828,7 @@ of course, also replace TO with a slightly larger value "Make a copy of TREE. 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 as well as conses." +argument VECP, this copies vectors and records as well as conses." (declare (side-effect-free error-free)) (if (consp tree) (let (result) @@ -839,8 +839,8 @@ argument VECP, this copies vectors as well as conses." (push newcar result)) (setq tree (cdr tree))) (nconc (nreverse result) - (if (and vecp (vectorp tree)) (copy-tree tree vecp) tree))) - (if (and vecp (vectorp tree)) + (if (and vecp (or (vectorp tree) (recordp tree))) (copy-tree tree vecp) tree))) + (if (and vecp (or (vectorp tree) (recordp tree))) (let ((i (length (setq tree (copy-sequence tree))))) (while (>= (setq i (1- i)) 0) (aset tree i (copy-tree (aref tree i) vecp))) -- 2.40.1