Subject: Re: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary")

From: Barry OReilly <[email-masked]>
Date: Tue, 21 Jan 2014 22:23:37 -0500

> * Sometimes the navigate down hangs with backtrace:
>
>   Debugger entered--Lisp error: (quit)
>      undo-tree-copy-list((nil))
>      undo-tree-redo-1(1)
>      undo-tree-visualize-redo(1)
>      call-interactively(undo-tree-visualize-redo nil nil)
>      command-execute(undo-tree-visualize-redo)

In a reproduction of this, at the start of undo-tree-copy-list,
undo-list is:

  (nil (undo-tree-id3 . -2))

Then in this while loop:

  (while (null copy)
    (setq copy
          (undo-tree-restore-GC-elts-from-pool (pop undo-list))))

undo-tree-restore-GC-elts-from-pool returns nil for both elements, so
the while loop never ends. Perhaps you want instead (ignore-whitespace
diff):

--- a/emacs/lisp/undo-tree.el    Fri Jan 17 19:18:15 2014 -0500
+++ b/emacs/lisp/undo-tree.el    Tue Jan 21 22:17:50 2014 -0500
@@ -1690,13 +1690,13 @@
 (defun undo-tree-copy-list (undo-list)
   ;; Return a deep copy of first changeset in `undo-list'. Object id's are
   ;; replaced by corresponding objects from `buffer-undo-tree' object-pool.
-  (when undo-list
     (let (copy p)
       ;; if first element contains an object id, replace it with object
from
       ;; pool, discarding element entirely if it's been GC'd
-      (while (null copy)
+    (while (and undo-list (null copy))
     (setq copy
           (undo-tree-restore-GC-elts-from-pool (pop undo-list))))
+    (when copy
       (setq copy (list copy)
         p copy)
       ;; copy remaining elements, replacing object id's with objects from