emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/undo-tree 7fb46cb 183/195: Fix copy-undo-tree by forcin


From: Stefan Monnier
Subject: [elpa] externals/undo-tree 7fb46cb 183/195: Fix copy-undo-tree by forcing vector rather than native defstruct.
Date: Sat, 28 Nov 2020 13:41:49 -0500 (EST)

branch: externals/undo-tree
commit 7fb46cb8e4804e4a4d1b540251d0e060fca1d759
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>

    Fix copy-undo-tree by forcing vector rather than native defstruct.
    
    Fixes broken undo-tree history saving in recent Emacsen that implement 
native
    defstruct types.
    
    (Better solution would be to implement bespoke undo-tree copier, rather than
    relying on copy-tree.)
---
 undo-tree.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/undo-tree.el b/undo-tree.el
index defe1d2..bf5b5c1 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -1332,6 +1332,7 @@ in visualizer."
 (defstruct
   (undo-tree
    :named
+   (:type vector)  ; needed for `copy-undo-tree' implementation
    (:constructor nil)
    (:constructor make-undo-tree
                  (&aux
@@ -1344,7 +1345,12 @@ in visualizer."
   root current size count object-pool)
 
 (defun copy-undo-tree (tree)
-  (copy-tree tree 'copy-vectors))
+  (unwind-protect
+      (progn
+       (undo-tree-decircle tree)
+       (copy-tree tree 'copy-vectors))
+    (undo-tree-recircle tree)))
+
 
 
 (defstruct



reply via email to

[Prev in Thread] Current Thread [Next in Thread]