From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Toby Cubitt Newsgroups: gmane.emacs.bugs Subject: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Date: Wed, 22 Jan 2014 17:05:18 +0000 Message-ID: <20140122170518.GA19716@c3po> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1390410374 26929 80.91.229.3 (22 Jan 2014 17:06:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jan 2014 17:06:14 +0000 (UTC) To: 16377@debbugs.gnu.org, gundaetiapo@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 22 18:06:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W61Ft-0000bZ-Ez for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jan 2014 18:06:21 +0100 Original-Received: from localhost ([::1]:36608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W61Fs-0008Iv-Vo for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jan 2014 12:06:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W61Ff-00086P-Cp for bug-gnu-emacs@gnu.org; Wed, 22 Jan 2014 12:06:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W61Fb-0004tS-1j for bug-gnu-emacs@gnu.org; Wed, 22 Jan 2014 12:06:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W61Fa-0004tF-LX for bug-gnu-emacs@gnu.org; Wed, 22 Jan 2014 12:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W61Fa-0004Ua-Bp for bug-gnu-emacs@gnu.org; Wed, 22 Jan 2014 12:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Toby Cubitt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jan 2014 17:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16377 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16377-submit@debbugs.gnu.org id=B16377.139041032817214 (code B ref 16377); Wed, 22 Jan 2014 17:06:02 +0000 Original-Received: (at 16377) by debbugs.gnu.org; 22 Jan 2014 17:05:28 +0000 Original-Received: from localhost ([127.0.0.1]:60888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W61F1-0004TZ-Mc for submit@debbugs.gnu.org; Wed, 22 Jan 2014 12:05:28 -0500 Original-Received: from sanddollar.geekisp.com ([216.168.135.167]:6795) by debbugs.gnu.org with smtp (Exim 4.80) (envelope-from ) id 1W61Ey-0004TL-6W for 16377@debbugs.gnu.org; Wed, 22 Jan 2014 12:05:25 -0500 Original-Received: (qmail 17461 invoked by uid 1003); 22 Jan 2014 17:05:23 -0000 Original-Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Wed, 22 Jan 2014 12:05:20 -0500 Content-Disposition: inline In-Reply-To: X-PGP-Key: http://www.dr-qubit.org/gpg-toby-pub.asc User-Agent: Mutt/1.5.22 (2013-10-16) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) X-Primary-Address: toby@dr-qubit.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83894 Archived-At: On Wed, Jan 22, 2014 at 10:26:05AM -0500, Barry OReilly wrote: > On Wed, Jan 22, 2014 at 9:17 AM, Toby Cubitt < > toby-dated-1391609828.ede38b@dr-qubit.org> 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 `buffer-undo-list'? 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 job!) Toby -- Dr T. S. Cubitt Royal Society University Research Fellow and Fellow of Churchill College, Cambridge Centre for Quantum Information DAMTP, University of Cambridge email: tsc25@cantab.net web: www.dr-qubit.org