[Top][All Lists]

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

bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list

From: Toby Cubitt
Subject: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary")
Date: Wed, 22 Jan 2014 17:05:18 +0000
User-agent: Mutt/1.5.22 (2013-10-16)

On Wed, Jan 22, 2014 at 10:26:05AM -0500, Barry OReilly wrote:
> On Wed, Jan 22, 2014 at 9:17 AM, Toby Cubitt <
> address@hidden> wrote:
> > On Tue, Jan 21, 2014 at 07:05:38PM -0500, Barry OReilly wrote:
> > > > The "Unrecognised entry" error suggests the undo-tree-canary symbol
> > > > has somehow ended up in a `buffer-undo-tree' entry.
> > >
> > > You mean "buffer-undo-list" not "buffer-undo-tree" right?
> >
> > No, I mean `buffer-undo-tree'. The canary should never end up there. In
> > undo-tree-mode, primitive-undo only ever gets called on an entry copied
> > from buffer-undo-tree. Hence my statement, above.
> >
> > > I checked Emacs 24.3 and as I suspected it's quite easy to make
> > > undo-tree-canary appear in the buffer-undo-list.
> >
> > It's *supposed* to be in buffer-undo-list. It's not supposed to ever be
> > in buffer-undo-tree. (And maybe it isn't, I'm just guessing from the
> > error message here. I haven't had time to investigate yet.)
> >
> > > What changed is the error checking in core Emacs. If you expected that
> > > undo-tree-canary would never be there between commands, that has not
> > > been so for some time.
> >
> > I didn't expect that.
> >
> > > Could you tell me more about the purpose of undo-tree-canary?
> >
> > It lets undo-tree-mode detect when Emacs has discarded undo history from
> > buffer-undo-list "behind undo-tree-mode's back". If the canary has
> > vanished when undo-tree-mode looks at buffer-undo-list, Emacs must have
> > purged some undo history.
> >
> > The new error checking in primitive-undo shouldn't affect undo-tree-mode
> > in any way. I still strongly suspect this is a bug in the very delicate
> > and relatively untested undo-in-region code, and the change to
> > primitive-undo is a red herring.
> >
> >
> In undo-tree-redo-1:
>   (setf (undo-tree-node-undo current)
>         (undo-list-pop-changeset 'discard-pos))
> In undo-list-pop-changeset:
>   (if (eq (car buffer-undo-list) 'undo-tree-canary)
>       (push nil buffer-undo-list)
>     [...])
> The push call returns (nil 'undo-tree-canary). This is how it gets
> into the buffer-undo-tree in my reproduction.

I think this is still a symptom, not the ultimate cause of the bug
(though I should probably guard against this better). `undo-tree-redo-1'
has previously called `primitive-undo', so you would expect
`buffer-undo-list' to contain at least one undo changeset (the one added
by `primitive-undo') when `undo-list-pop-changeset' is called.

Are there circumstances in which `primitive-undo' doesn't add to

Anyway, I need to step through the code and figure out what's going
on. Which I'll do as soon as I have a block of free time to set aside for
elisp debugging.

> I'll close the Emacs bug since we're fairly sure at this point it's an
> undo-tree bug.

Yup, fine by me. I think what's happened is that the new error checking
in `primitive-undo' simply caught this undo-tree bug (so it's doing its

Dr T. S. Cubitt
Royal Society University Research Fellow
and Fellow of Churchill College, Cambridge
Centre for Quantum Information
DAMTP, University of Cambridge

email: address@hidden
web:   www.dr-qubit.org

reply via email to

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