[Top][All Lists]

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

[elpa] externals/undo-tree 0ba2d37 122/195: Fix bug in undo-tree-clear-v

From: Stefan Monnier
Subject: [elpa] externals/undo-tree 0ba2d37 122/195: Fix bug in undo-tree-clear-visualizer-data.
Date: Sat, 28 Nov 2020 13:41:35 -0500 (EST)

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

    Fix bug in undo-tree-clear-visualizer-data.
    Previous code caused any nil elements in undo-tree-node-meta-data plist to 
    deleted along with the visualizer data.
 undo-tree.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/undo-tree.el b/undo-tree.el
index b8212a5..2db9bcd 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -1284,13 +1284,13 @@ in visualizer."
   (let ((len (length (undo-tree-make-visualizer-data))))
     `(and (vectorp ,v) (= (length ,v) ,len))))
-(defmacro undo-tree-node-clear-visualizer-data (node)
-  `(setf (undo-tree-node-meta-data ,node)
-        (delq nil
-              (delq :visualizer
-                    (plist-put (undo-tree-node-meta-data ,node)
-                               :visualizer nil)))))
+(defun undo-tree-node-clear-visualizer-data (node)
+  (let ((plist (undo-tree-node-meta-data node)))
+    (if (eq (car plist) :visualizer)
+       (setf (undo-tree-node-meta-data node) (nthcdr 2 plist))
+      (while (and plist (not (eq (cadr plist) :visualizer)))
+       (setq plist (cdr plist)))
+      (if plist (setcdr plist (nthcdr 3 plist))))))
 (defmacro undo-tree-node-lwidth (node)
   `(let ((v (plist-get (undo-tree-node-meta-data ,node) :visualizer)))

reply via email to

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