From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 06 19:32:52 2014 Received: (at submit) by debbugs.gnu.org; 7 Jan 2014 00:32:52 +0000 Received: from localhost ([127.0.0.1]:39631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W0KbD-0002r8-Jc for submit@debbugs.gnu.org; Mon, 06 Jan 2014 19:32:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53468) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W0KbC-0002r1-AR for submit@debbugs.gnu.org; Mon, 06 Jan 2014 19:32:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0KbB-0001da-1V for submit@debbugs.gnu.org; Mon, 06 Jan 2014 19:32:50 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0KbA-0001dW-V0 for submit@debbugs.gnu.org; Mon, 06 Jan 2014 19:32:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0Kb9-0003aI-Rh for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2014 19:32:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0Kb8-0001d8-Qr for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2014 19:32:47 -0500 Received: from mail-ob0-x22e.google.com ([2607:f8b0:4003:c01::22e]:45662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0Kb8-0001d2-KE for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2014 19:32:46 -0500 Received: by mail-ob0-f174.google.com with SMTP id wn1so19086371obc.19 for ; Mon, 06 Jan 2014 16:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=4rvCkEF7Qh3amONC0K9SW1PqhHGf80FVKd5TTVrZwk0=; b=Nh+nQuIOknkApJSyYZxr2iWh8iMdjQb6h5ChNPP39NYr48mURkMeMsgS7AY5vH8I4e 0DqSPNMNg51kWZY0CjlTqBQXlaoNBV6xezlUJogh1kkLW5fRkQJvjshonpSeUaXV07hI I3sXZwQvO5wIOl9n3CQsGWmYb6IU2AucKCIEsgeP2H/C+bYe2tuxv1MC9r5vE8XG8H7f Pox0bXlJIuj+Bp2YdptvHU7L086QAx9CWKUivrW+f9ySx67tvBIVsedYJhy/EXCDtmxU KHesRA/prsomRjhIyroL5810XfwYlUpMV1+kgDudcQ2hLhfV9u2zXK1/yQKiHvISX2Q2 poWg== MIME-Version: 1.0 X-Received: by 10.60.97.71 with SMTP id dy7mr157595oeb.73.1389054765555; Mon, 06 Jan 2014 16:32:45 -0800 (PST) Received: by 10.76.156.103 with HTTP; Mon, 6 Jan 2014 16:32:45 -0800 (PST) Date: Mon, 6 Jan 2014 19:32:45 -0500 Message-ID: Subject: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") From: Barry OReilly To: toby-undo-tree@dr-qubit.org, bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=089e013a1774dfe60104ef56830d X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --089e013a1774dfe60104ef56830d Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Don't know yet if the code change belongs in Undo Tree or Emacs but the recipe is: =95 Start Emacs in scratch buffer with global-undo-tree-mode enabled =95 Go to BOB and insert "xxx" =95 Select first line =95 undo-tree-undo in region =95 undo-tree-redo in region =95 undo-tree-visualize =95 Navigate down (redo)* =95 Navigate up (undo) Upon the navigate up, this error occurs: Debugger entered--Lisp error: (error "Unrecognized entry in undo list undo-tree-canary") signal(error ("Unrecognized entry in undo list undo-tree-canary")) error("Unrecognized entry in undo list %S" undo-tree-canary) primitive-undo(1 (undo-tree-canary)) undo-tree-undo-1(1) undo-tree-visualize-undo(1) call-interactively(undo-tree-visualize-undo nil nil) command-execute(undo-tree-visualize-undo) * 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) Don't know if it's related or not. This recipe does not cause a problem with Emacs 24.3. The following commit is suspicious: commit 0c180ea96c022923ef18a255d0492bdb5ad04e02 Author: Aaron S. Hawley Date: Tue Jan 8 14:13:31 2013 -0500 * lisp/simple.el (primitive-undo): Move from undo.c. * src/undo.c (Fprimitive_undo): Move to simple.el. (syms_of_undo): Remove declaration for Sprimitive_undo. * test/automated/undo-tests.el: New file. The commit moved primitive-undo from C to Elisp. In the process, it added an else condition not present in the C code: + (t (error "Unrecognized entry in undo list %S" next))))) The consequence of this bug is that when using Undo Tree, recent undo history can become completely inaccessible. I should note that if I don't undo in region, Undo Tree has never run into any problems with the Emacs on trunk. --089e013a1774dfe60104ef56830d Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
Don't know yet if the code change belongs in Undo Tree= or Emacs but
the recipe is:

=A0 =95 Start Emacs in scratch buffe= r with global-undo-tree-mode enabled
=A0 =95 Go to BOB and insert "= xxx"
=A0 =95 Select first line
=A0 =95 undo-tree-undo in region
=A0 =95 un= do-tree-redo in region
=A0 =95 undo-tree-visualize
=A0 =95 Navigate d= own (redo)*
=A0 =95 Navigate up (undo)

Upon the navigate up, this= error occurs:

=A0 Debugger entered--Lisp error: (error "Unrecognized entry in undo l= ist undo-tree-canary")
=A0=A0=A0=A0 signal(error ("Unrecognize= d entry in undo list undo-tree-canary"))
=A0=A0=A0=A0 error("U= nrecognized entry in undo list %S" undo-tree-canary)
=A0=A0=A0=A0 primitive-undo(1 (undo-tree-canary))
=A0=A0=A0=A0 undo-tree= -undo-1(1)
=A0=A0=A0=A0 undo-tree-visualize-undo(1)
=A0=A0=A0=A0 call= -interactively(undo-tree-visualize-undo nil nil)
=A0=A0=A0=A0 command-ex= ecute(undo-tree-visualize-undo)

* Sometimes the navigate down hangs with backtrace:

=A0 Debugger ent= ered--Lisp error: (quit)
=A0=A0=A0=A0 undo-tree-copy-list((nil))
=A0= =A0=A0=A0 undo-tree-redo-1(1)
=A0=A0=A0=A0 undo-tree-visualize-redo(1)=A0=A0=A0=A0 call-interactively(undo-tree-visualize-redo nil nil)
=A0=A0=A0=A0 command-execute(undo-tree-visualize-redo)

Don't kno= w if it's related or not.

This recipe does not cause a problem w= ith Emacs 24.3.

The following commit is suspicious:

commit 0c= 180ea96c022923ef18a255d0492bdb5ad04e02
Author: Aaron S. Hawley <aar= on.s.hawley@gmail.com>
Date:=A0=A0 Tue Jan 8 14:13:31 2013 -0500<= br>
=A0=A0=A0 * lisp/simple.el (primitive-undo): Move from undo.c.
= =A0=A0=A0 * src/undo.c (Fprimitive_undo): Move to simple.el.
=A0=A0=A0 (syms_of_undo): Remove declaration for Sprimitive_undo.
=A0=A0= =A0 * test/automated/undo-tests.el: New file.

The commit moved primi= tive-undo from C to Elisp. In the process, it
added an else condition no= t present in the C code:

+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (t (error "Unrecognized entr= y in undo list %S" next)))))

The consequence of this bug is tha= t when using Undo Tree, recent undo
history can become completely inacce= ssible.

I should note that if I don't undo in region, Undo Tree = has never run
into any problems with the Emacs on trunk.

--089e013a1774dfe60104ef56830d-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 06 23:15:05 2014 Received: (at submit) by debbugs.gnu.org; 7 Jan 2014 04:15:05 +0000 Received: from localhost ([127.0.0.1]:39878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W0O4G-000273-6N for submit@debbugs.gnu.org; Mon, 06 Jan 2014 23:15:04 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53347) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W0O4D-00026N-3S for submit@debbugs.gnu.org; Mon, 06 Jan 2014 23:15:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0O48-0008OL-6I for submit@debbugs.gnu.org; Mon, 06 Jan 2014 23:15:00 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_50,FAKE_REPLY_C autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0O48-0008OH-3p for submit@debbugs.gnu.org; Mon, 06 Jan 2014 23:14:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0O43-00027E-Ng for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2014 23:14:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0O3z-0008NX-Bz for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2014 23:14:51 -0500 Received: from starfish.geekisp.com ([216.168.135.166]:23105) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1W0O3z-0008NT-6n for bug-gnu-emacs@gnu.org; Mon, 06 Jan 2014 23:14:47 -0500 Received: (qmail 9382 invoked by uid 1003); 7 Jan 2014 04:14:46 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Mon, 06 Jan 2014 23:14:43 -0500 Date: Tue, 7 Jan 2014 04:14:42 +0000 To: Barry OReilly Subject: Re: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: <20140107041442.GA12172@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-detected-operating-system: by eggs.gnu.org: OpenBSD 4.x-5.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Toby Cubitt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) Hi Barry, Thanks for the bug report and recipe. On Mon, Jan 06, 2014 at 07:32:45PM -0500, Barry OReilly wrote: > Don't know yet if the code change belongs in Undo Tree or Emacs but > the recipe is: > > • Start Emacs in scratch buffer with global-undo-tree-mode enabled > • Go to BOB and insert "xxx" > • Select first line > • undo-tree-undo in region > • undo-tree-redo in region > • undo-tree-visualize > • Navigate down (redo)* > • Navigate up (undo) > > Upon the navigate up, this error occurs: > > Debugger entered--Lisp error: (error "Unrecognized entry in undo list > undo-tree-canary") > signal(error ("Unrecognized entry in undo list undo-tree-canary")) > error("Unrecognized entry in undo list %S" undo-tree-canary) > primitive-undo(1 (undo-tree-canary)) > undo-tree-undo-1(1) > undo-tree-visualize-undo(1) > call-interactively(undo-tree-visualize-undo nil nil) > command-execute(undo-tree-visualize-undo) I also can't reproduce this in current stable Emacs. (Which is odd, as my first guess from the backtrace would have been that this is a bug in the relatively untested undo-tree undo-in-region code, and nothing to do with Emacs.) > * 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) > > Don't know if it's related or not. > > This recipe does not cause a problem with Emacs 24.3. Confirmed. > The following commit is suspicious: > > commit 0c180ea96c022923ef18a255d0492bdb5ad04e02 > Author: Aaron S. Hawley > Date: Tue Jan 8 14:13:31 2013 -0500 > > * lisp/simple.el (primitive-undo): Move from undo.c. > * src/undo.c (Fprimitive_undo): Move to simple.el. > (syms_of_undo): Remove declaration for Sprimitive_undo. > * test/automated/undo-tests.el: New file. > > The commit moved primitive-undo from C to Elisp. In the process, it > added an else condition not present in the C code: > > + (t (error "Unrecognized entry in undo list %S" next))))) OK, who messed with `primitive-undo' without making absolutely sure the elisp implementation was strictly identical to the aeons-old c implementation, and can I shoot them please? ;-) Seriously, from the backtrace, the error does seem to be thrown by the new test. Whether that's an Emacs regression, or just that the new test is catching an existing bug in undo-tree, is harder to tell. I'll play around with it in a fresh vcs Emacs when I have some time. In the meantime, since this *is* a regression of sorts(*), can you bisect to confirm this is the commit that broke things? (*) I'd hope that a key requirement of moving `primitive-undo' to elisp is surely that it not introduce changes in behaviour. > The consequence of this bug is that when using Undo Tree, recent undo > history can become completely inaccessible. > > I should note that if I don't undo in region, Undo Tree has never run > into any problems with the Emacs on trunk. Have you hit other reproducible undo-in-region bugs on trunk? If so, please report them! The undo-tree undo-in-region code is fiendishly complex, hard to test, and under-tested. Best, Toby PS: Sorry if I've broken threading on bug-gnu-emacs and generated a new bug number. I have delivery disabled currently as I don't have time to follow it. But it seems worth copying my reply there. -- 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 07 22:37:32 2014 Received: (at submit) by debbugs.gnu.org; 8 Jan 2014 03:37:32 +0000 Received: from localhost ([127.0.0.1]:41811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W0jxT-00028i-MN for submit@debbugs.gnu.org; Tue, 07 Jan 2014 22:37:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:39237) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W0jxR-00028a-DD for submit@debbugs.gnu.org; Tue, 07 Jan 2014 22:37:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0jxM-0000Wc-J0 for submit@debbugs.gnu.org; Tue, 07 Jan 2014 22:37:29 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: ** X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_50,FAKE_REPLY_C autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0jxM-0000WX-FV for submit@debbugs.gnu.org; Tue, 07 Jan 2014 22:37:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0jxE-0007Wf-1A for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2014 22:37:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0jx9-0000Sb-2w for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2014 22:37:15 -0500 Received: from starfish.geekisp.com ([216.168.135.166]:10122) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1W0jx8-0000S9-V3 for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2014 22:37:11 -0500 Received: (qmail 7612 invoked by uid 1003); 8 Jan 2014 03:37:09 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Tue, 07 Jan 2014 22:37:06 -0500 Date: Wed, 8 Jan 2014 03:37:04 +0000 To: Barry OReilly Subject: Re: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: <20140108033704.GA16400@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-detected-operating-system: by eggs.gnu.org: OpenBSD 4.x-5.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Toby Cubitt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) On Mon, Jan 06, 2014 at 07:32:45PM -0500, Barry OReilly wrote: > Don't know yet if the code change belongs in Undo Tree or Emacs but > the recipe is: > > • Start Emacs in scratch buffer with global-undo-tree-mode enabled > • Go to BOB and insert "xxx" > • Select first line > • undo-tree-undo in region > • undo-tree-redo in region > • undo-tree-visualize > • Navigate down (redo)* > • Navigate up (undo) > > Upon the navigate up, this error occurs: > > Debugger entered--Lisp error: (error "Unrecognized entry in undo list > undo-tree-canary") > signal(error ("Unrecognized entry in undo list undo-tree-canary")) > error("Unrecognized entry in undo list %S" undo-tree-canary) > primitive-undo(1 (undo-tree-canary)) > undo-tree-undo-1(1) > undo-tree-visualize-undo(1) > call-interactively(undo-tree-visualize-undo nil nil) > command-execute(undo-tree-visualize-undo) > > * 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) OK, I can reproduce this. Here's a precise recipe: 1. emacs -Q 2. M-x load-file ~/undo-tree.elc 3. M-x global-undo-tree-mode 4. M-< 5. type "xxx" 6. C-a, C-SPC, C-e 7. C-/ 8. C-g 9. C-a, C-SPC, C-e 10. C-? 11. C-g 12. C-x u 13. 14. For me, this causes Emacs to hang in an infinite loop. I managed to trigger the "Unrecognized entry" error once, but now I can't reproduce it. (Unfortunately, because of the way Emacs' undo system works, tiny changes to the precise sequence of commands can affect how it behaves - even apparently benign things like moving the point. I've never encountered so many Heisenbugs as when coding undo-tree :-/ This looks like an undo-tree bug to me. The "Unrecognised entry" error suggests the undo-tree-canary symbol has somehow ended up in a `buffer-undo-tree' entry. That should never happen. However, I don't understand why this should depend on which Emacs version one runs. I'll keep investigating. If you can rediscover the precise sequence of steps required to trigger the error instead of the hang, please send them to me! Best, 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 19:05:44 2014 Received: (at submit) by debbugs.gnu.org; 22 Jan 2014 00:05:44 +0000 Received: from localhost ([127.0.0.1]:59950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5lKC-0004ut-BN for submit@debbugs.gnu.org; Tue, 21 Jan 2014 19:05:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42849) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5lKB-0004um-5B for submit@debbugs.gnu.org; Tue, 21 Jan 2014 19:05:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5lK9-0002QP-VK for submit@debbugs.gnu.org; Tue, 21 Jan 2014 19:05:42 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5lK9-0002QL-Qh for submit@debbugs.gnu.org; Tue, 21 Jan 2014 19:05:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5lK8-0004gW-Sf for bug-gnu-emacs@gnu.org; Tue, 21 Jan 2014 19:05:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5lK7-0002Q7-RU for bug-gnu-emacs@gnu.org; Tue, 21 Jan 2014 19:05:40 -0500 Received: from mail-oa0-x236.google.com ([2607:f8b0:4003:c02::236]:57121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5lK7-0002Py-FB for bug-gnu-emacs@gnu.org; Tue, 21 Jan 2014 19:05:39 -0500 Received: by mail-oa0-f54.google.com with SMTP id i4so3430247oah.13 for ; Tue, 21 Jan 2014 16:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=A1d48rq/J+LtgiNqLF0l011O8AtPZLMFDXt1yCoQqCg=; b=k2/sCO/Ik2m2mSNBN/Oc7IasJ/fXzWOATyuoxjjpnom1RIK6wJna+xdchOITEXjiPz sjazghzJgxkY6z3KnvL2ZivEaC4v0cuclk/firtppOechzPMRBGv6ybZA96UcHBsYmAC JdycYvZVEJ4DhmvdKa7Ke0PqL6ZsN2vyTXbmdR2jmb+LtzwgbwPsKypjJ8V2ByC84bhJ 9YwXDxpkRQjBVJbptg0T495GIxPbWUfsbKc9zzCMjEueLZJS5ekBfHKgMzsLx9cn7aBy Pz1VDoM9QNWa+yNGuo7Poljr+s5qMMy9qc3y3pk9w8V5E1VtOtFbUy3zHZpWnZnXhg0s FbMQ== MIME-Version: 1.0 X-Received: by 10.60.137.201 with SMTP id qk9mr14184339oeb.41.1390349138601; Tue, 21 Jan 2014 16:05:38 -0800 (PST) Received: by 10.76.21.84 with HTTP; Tue, 21 Jan 2014 16:05:38 -0800 (PST) In-Reply-To: <20140108033704.GA16400@c3po> References: <20140108033704.GA16400@c3po> Date: Tue, 21 Jan 2014 19:05:38 -0500 Message-ID: Subject: Re: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") From: Barry OReilly To: Toby Cubitt Content-Type: multipart/alternative; boundary=047d7b33cdfc852e4504f083e244 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --047d7b33cdfc852e4504f083e244 Content-Type: text/plain; charset=ISO-8859-1 > 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? I checked Emacs 24.3 and as I suspected it's quite easy to make undo-tree-canary appear in the buffer-undo-list. 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. Could you tell me more about the purpose of undo-tree-canary? --047d7b33cdfc852e4504f083e244 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> The "Unrecognised entry" error suggests the= undo-tree-canary symbol
> has somehow ended up in a `buffer-undo-tre= e' entry.

You mean "buffer-undo-list" not "buffer= -undo-tree" right?

I checked Emacs 24.3 and as I suspected it's quite easy to make
= undo-tree-canary appear in the buffer-undo-list. What changed is the
err= or checking in core Emacs. If you expected that undo-tree-canary
would n= ever be there between commands, that has not been so for some
time.

Could you tell me more about the purpose of undo-tree-canary?<= br>
--047d7b33cdfc852e4504f083e244-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 22:23:45 2014 Received: (at submit) by debbugs.gnu.org; 22 Jan 2014 03:23:45 +0000 Received: from localhost ([127.0.0.1]:60084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5oPo-0001sq-Mx for submit@debbugs.gnu.org; Tue, 21 Jan 2014 22:23:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44052) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5oPl-0001se-BY for submit@debbugs.gnu.org; Tue, 21 Jan 2014 22:23:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5oPk-0006RS-5Y for submit@debbugs.gnu.org; Tue, 21 Jan 2014 22:23:41 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5oPk-0006RO-2a for submit@debbugs.gnu.org; Tue, 21 Jan 2014 22:23:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5oPj-0005Tn-57 for bug-gnu-emacs@gnu.org; Tue, 21 Jan 2014 22:23:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5oPi-0006R5-AY for bug-gnu-emacs@gnu.org; Tue, 21 Jan 2014 22:23:39 -0500 Received: from mail-oa0-x231.google.com ([2607:f8b0:4003:c02::231]:39287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5oPi-0006R1-4s for bug-gnu-emacs@gnu.org; Tue, 21 Jan 2014 22:23:38 -0500 Received: by mail-oa0-f49.google.com with SMTP id i7so7944931oag.36 for ; Tue, 21 Jan 2014 19:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iFYTS+ObGEQnv29UBZ6W5N+5A5NOylwCimUz5RmZEmw=; b=L9iLCccgAopX/mdA4eF5MGUkgcjF5DlQjmO9KQbps3H7uw/y+egxTDAfcqxE2oUEH8 qeSJq18qTcKeCaR6gTFjwint8lG2qZecYh4rQE69YNo5uqh7JzNcQ/SbKK7slorLFHrs OvE0ad/YSOCwbOTnxi2E9d9tnA9CXf3t+cL0BDEwNmUDlw9aDg0QIrYoV4j9SO78Jx93 hCSrMt1qzT6IUwKVe6eF0StybAjnKXwAJdtTPN857BXgXxVdNThVV+DvJI3/pyyrzqAh eNrYo1Tm7WowawVq0/WvxVffocGmieZ1e1dq9qYtLJJDk31NGnu0jodXBiOkRWTwDc50 wtBA== MIME-Version: 1.0 X-Received: by 10.60.124.138 with SMTP id mi10mr4966025oeb.57.1390361017529; Tue, 21 Jan 2014 19:23:37 -0800 (PST) Received: by 10.76.21.84 with HTTP; Tue, 21 Jan 2014 19:23:37 -0800 (PST) In-Reply-To: <20140107041442.GA12172@c3po> References: <20140107041442.GA12172@c3po> Date: Tue, 21 Jan 2014 22:23:37 -0500 Message-ID: Subject: Re: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") From: Barry OReilly To: Toby Cubitt Content-Type: multipart/alternative; boundary=047d7b5d5fba8f3cd904f086a6d9 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --047d7b5d5fba8f3cd904f086a6d9 Content-Type: text/plain; charset=ISO-8859-1 > * 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 --047d7b5d5fba8f3cd904f086a6d9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
> * Sometimes the navigate down hangs with backtrace:>
>=A0=A0 Debugger entered--Lisp error: (quit)
>=A0=A0=A0= =A0=A0 undo-tree-copy-list((nil))
>=A0=A0=A0=A0=A0 undo-tree-redo-1(1= )
>=A0=A0=A0=A0=A0 undo-tree-visualize-redo(1)
>=A0=A0=A0=A0=A0 call-interactively(undo-tree-visualize-redo nil nil)>=A0=A0=A0=A0=A0 command-execute(undo-tree-visualize-redo)

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

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

Then in this while loop:

=A0 (while (null copy)
=A0=A0=A0 (se= tq copy
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (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
d= iff):

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


--047d7b5d5fba8f3cd904f086a6d9-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 10:26:12 2014 Received: (at 16377-done) by debbugs.gnu.org; 22 Jan 2014 15:26:12 +0000 Received: from localhost ([127.0.0.1]:60779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5zgx-0006mY-10 for submit@debbugs.gnu.org; Wed, 22 Jan 2014 10:26:11 -0500 Received: from mail-oa0-f44.google.com ([209.85.219.44]:60563) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W5zgs-0006mO-OI for 16377-done@debbugs.gnu.org; Wed, 22 Jan 2014 10:26:07 -0500 Received: by mail-oa0-f44.google.com with SMTP id g12so599457oah.17 for <16377-done@debbugs.gnu.org>; Wed, 22 Jan 2014 07:26:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Gl68iFLRR/o8H73uI0/nZm3P1xcbZa6QaJyNEdcWRn0=; b=xsDAhIS2+mmtL+FzSWcJi/dKnRfMsAjzqNVza4kA2fsBMa9fYCOfTNB0ZzCAOgmFUM E+QKet3eiDCve3Ru/S5p89joiLRD1VQagQGNATDUyiOLEXwg95LEMBT49jTfO4iQLGpS 92A8zLpU5rHTA6vEgOKD51LQr9S9AFcK8R6fopbGDDongmM3fJIPy5gpKyaqu2cuYG1Z np+hqmIuR9bziq0TSi53qA+Xir/+TUpRNixP1Pib0tSEsH7OnpyAlb8p7E0hClEpvYu9 Bn08gdfV1MW1QjMa4tcSOFk0VFuARWtrn+LinWlyzBOcJOoTBz5JTL0sdaP4t29RFen2 KACw== MIME-Version: 1.0 X-Received: by 10.60.228.135 with SMTP id si7mr1806146oec.4.1390404365631; Wed, 22 Jan 2014 07:26:05 -0800 (PST) Received: by 10.76.21.84 with HTTP; Wed, 22 Jan 2014 07:26:05 -0800 (PST) In-Reply-To: <20140122141701.GA6728@c3po> References: <20140122141701.GA6728@c3po> Date: Wed, 22 Jan 2014 10:26:05 -0500 Message-ID: Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") From: Barry OReilly To: Toby Cubitt , 16377-done@debbugs.gnu.org Content-Type: multipart/alternative; boundary=001a113639104ed25904f090bea0 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 16377-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a113639104ed25904f090bea0 Content-Type: text/plain; charset=ISO-8859-1 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'll close the Emacs bug since we're fairly sure at this point it's an undo-tree bug. --001a113639104ed25904f090bea0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On W= ed, Jan 22, 2014 at 9:17 AM, Toby Cubitt <toby-dat= ed-1391609828.ede38b@dr-qubit.org> wrote:
On Tue, Jan 21, 2014 at 0= 7:05:38PM -0500, Barry OReilly wrote:
> > The "Unrecognised entry" error suggests the undo-tree-c= anary 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 eve= r be
in buffer-undo-tree. (And maybe it isn't, I'm just guessing from th= e
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 canar= y 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-mod= e
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:

=A0 (setf (undo-tree= -node-undo current)
=A0=A0=A0=A0=A0=A0=A0 (undo-list-pop-changeset '= discard-pos))

In undo-list-pop-changeset:

=A0 (if (eq (car bu= ffer-undo-list) 'undo-tree-canary)
=A0=A0=A0=A0=A0 (push nil buffer-undo-list)
=A0=A0=A0 [...])

The = push call returns (nil 'undo-tree-canary). This is how it gets
into = the buffer-undo-tree in my reproduction.

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

--001a113639104ed25904f090bea0-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 12:05:28 2014 Received: (at 16377) by debbugs.gnu.org; 22 Jan 2014 17:05:28 +0000 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 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 Received: (qmail 17461 invoked by uid 1003); 22 Jan 2014 17:05:23 -0000 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 Date: Wed, 22 Jan 2014 17:05:18 +0000 To: 16377@debbugs.gnu.org, gundaetiapo@gmail.com Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: <20140122170518.GA19716@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16377 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 13:39:56 2014 Received: (at control) by debbugs.gnu.org; 22 Jan 2014 18:39:56 +0000 Received: from localhost ([127.0.0.1]:60926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W62iR-0006zf-OR for submit@debbugs.gnu.org; Wed, 22 Jan 2014 13:39:55 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:56192) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W62iP-0006zX-Gy for control@debbugs.gnu.org; Wed, 22 Jan 2014 13:39:54 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1W62iO-0001W4-VH for control@debbugs.gnu.org; Wed, 22 Jan 2014 13:39:53 -0500 Date: Wed, 22 Jan 2014 13:39:52 -0500 Message-Id: Subject: control message for bug 16523 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.6 (-----) forcemerge 16377 16523 From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 13:56:19 2014 Received: (at 16377) by debbugs.gnu.org; 22 Jan 2014 18:56:19 +0000 Received: from localhost ([127.0.0.1]:60930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W62yJ-00006h-Co for submit@debbugs.gnu.org; Wed, 22 Jan 2014 13:56:19 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:37464) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W62yD-00006V-UY for 16377@debbugs.gnu.org; Wed, 22 Jan 2014 13:56:16 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rxHA/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av4EABK/CFG4rxHA/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="45620445" Received: from 184-175-17-192.dsl.teksavvy.com (HELO pastel.home) ([184.175.17.192]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Jan 2014 13:56:12 -0500 Received: by pastel.home (Postfix, from userid 20848) id B4FFB60323; Wed, 22 Jan 2014 13:56:12 -0500 (EST) From: Stefan Monnier To: Toby Cubitt Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: References: <20140122170518.GA19716@c3po> Date: Wed, 22 Jan 2014 13:56:12 -0500 In-Reply-To: <20140122170518.GA19716@c3po> (Toby Cubitt's message of "Wed, 22 Jan 2014 17:05:18 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 16377 Cc: 16377@debbugs.gnu.org, gundaetiapo@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Are there circumstances in which `primitive-undo' doesn't add to > `buffer-undo-list'? Of course: if there are no changes until the next undo boundary, then primitive-undo just doesn't do anything other than pop that undo boundary. And primitive-undo doesn't add any boundary, so it can end up with no change at all to buffer-undo-list. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 16:30:42 2014 Received: (at 16377) by debbugs.gnu.org; 22 Jan 2014 21:30:43 +0000 Received: from localhost ([127.0.0.1]:32770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W65Ni-00046q-II for submit@debbugs.gnu.org; Wed, 22 Jan 2014 16:30:42 -0500 Received: from starfish.geekisp.com ([216.168.135.166]:45234) by debbugs.gnu.org with smtp (Exim 4.80) (envelope-from ) id 1W65Ng-00046i-8d for 16377@debbugs.gnu.org; Wed, 22 Jan 2014 16:30:40 -0500 Received: (qmail 18066 invoked by uid 1003); 22 Jan 2014 21:30:39 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Wed, 22 Jan 2014 16:30:36 -0500 Date: Wed, 22 Jan 2014 21:30:34 +0000 To: Stefan Monnier Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: <20140122213034.GA18257@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16377 Cc: 16377@debbugs.gnu.org, gundaetiapo@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On Wed, Jan 22, 2014 at 01:56:12PM -0500, Stefan Monnier wrote: > > Are there circumstances in which `primitive-undo' doesn't add to > > `buffer-undo-list'? > > Of course: if there are no changes until the next undo boundary, then > primitive-undo just doesn't do anything other than pop that > undo boundary. > And primitive-undo doesn't add any boundary, so it can end up with no > change at all to buffer-undo-list. Makes sense. This shouldn't happen in undo-tree, since normally it should only call `primitive-undo' on a non-empty undo changeset...except it's just possible that undo-tree's undo-in-region could add empty changesets to buffer-undo-tree under some circumstances. Which might explain why this error is triggered by undo-in-region, but not in normal undo-tree usage. I'll investigate when I have time. In any case, it seems clear to me that it's an existing undo-tree bug that's been brought to light by the new error checking, rather than breakage from the new `primitive-undo' implementation. So the ball's in my court. 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 From unknown Thu Aug 14 18:40:37 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 20 Feb 2014 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 05 20:29:12 2017 Received: (at control) by debbugs.gnu.org; 6 Jul 2017 00:29:12 +0000 Received: from localhost ([127.0.0.1]:53905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSufQ-00020z-FT for submit@debbugs.gnu.org; Wed, 05 Jul 2017 20:29:12 -0400 Received: from gateway30.websitewelcome.com ([192.185.152.11]:22692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSufO-00020r-Be for control@debbugs.gnu.org; Wed, 05 Jul 2017 20:29:10 -0400 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway30.websitewelcome.com (Postfix) with ESMTP id F19EE2FC1C for ; Wed, 5 Jul 2017 19:29:09 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id Suf1dR3sAUy7vSuf2dUQ94; Wed, 05 Jul 2017 19:28:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cgrskv3qI+sQo8e5G+xqb7Hr2WolNqi3Mnk4DJrP/a0=; b=IUodvJdHftpG7LFnG+ijYgZU7L fCBWdvQ0Q9ewiFlwQ3TUsCFX7wnIV7DnAExfBMDaaSJNXloV7ca8NTisgFHk0MWVilFo5zH3sQtBi vV1CdaP1LKzYXPXbwSNJf1FDS5FCAnSbJxUxYs9CsL923kZmovcvEkwpuMFID5FNt1MrENVIjU9j2 hPMelV+gICPt83mnPGaUJN+H3ni8A8B5oMQqhGMy6wFAYeD432qs/kblLabQCQgcS/Vdc7gB3Th8/ KQhTOPxClYKH25UBn170YNOQBtWwZJkQ29Flw3IB3nZLqO0Dz3ZVPtL3F16y198oM7S+JwC33GmOm vuoLpMiw==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:56348 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1dSufN-004Bcf-C5 for control@debbugs.gnu.org; Wed, 05 Jul 2017 19:29:09 -0500 Date: Wed, 05 Jul 2017 17:29:08 -0700 Message-ID: From: Keith David Bershatsky To: control@debbugs.gnu.org Subject: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1dSufN-004Bcf-C5 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:56348 X-Source-Auth: lawlist X-Email-Count: 5 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) unarchive 16377 From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 05 20:34:24 2017 Received: (at 16377) by debbugs.gnu.org; 6 Jul 2017 00:34:24 +0000 Received: from localhost ([127.0.0.1]:53912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSukS-00029V-1R for submit@debbugs.gnu.org; Wed, 05 Jul 2017 20:34:24 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.139]:35180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSukQ-00029L-0j for 16377@debbugs.gnu.org; Wed, 05 Jul 2017 20:34:22 -0400 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 3AC0129DFA9 for <16377@debbugs.gnu.org>; Wed, 5 Jul 2017 19:33:59 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id SujhdR9AuUy7vSujhdUVPk; Wed, 05 Jul 2017 19:33:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9pvhzsKC0ES+mNW+DOdwwC/TYF281E4JGMX5NQz8Xwg=; b=ivEybSJ7JlBddTP0A1ANNQ6kl2 JQPVzMZStcYaRm8D5SSJgDi5I3h1dmuDxpyTvNouO842EWnFGcrt8RDybhviWfdo9McfzdIgP8Qsc vqxN+6PU8EQy2BotpjVq7yDAtnqD1np+pZClCPn7YpwO0CAPN8FZ56CEVHnW/UIaXyKR5GG9JyxBQ JVYDINgnzj9Xl34K5elSbDD5MvkTPHtvY6YHd5/o3dMeMU9AXG8edIRrOVZl7GB+Be2aNEz/YLAkJ eP3asb1C+9LUIN/7lpFziNf35iC5+VCXjW5mxO1zsc6NOWaGA8CBSvjfhjmnBTBdvmXD8QbYyDJ5F I9DlVteA==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:56396 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1dSuk2-004G3N-ET for 16377@debbugs.gnu.org; Wed, 05 Jul 2017 19:33:58 -0500 Date: Wed, 05 Jul 2017 17:33:57 -0700 Message-ID: From: Keith David Bershatsky To: 16377@debbugs.gnu.org Subject: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1dSuk2-004G3N-ET X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:56396 X-Source-Auth: lawlist X-Email-Count: 6 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 16377 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) I have been working on a fork of undo-tree.el, and am interested in resolving this particular bug. I saw a recent post on reddit/emacs asking for help on this issue, and thought I would take this opportunity to chime-in. I am presently using the following modified version of primitive-undo in my forked version for 2 reasons. First, is to just throw a message instead of an error if bug 16377 shows its head. Second, I like to have the window-point update in the target window while I am doing a change in the undo-tree visualization buffer. I have no idea whether bypassing the error about 16377 is a bad thing, so I thought I'd share my function and let the experts decide how best to handle the bug. I also wanted to remind the powers that be that this bug still affects people in today's day and age. Another user on reddit added a comment stating he/she also had the same problem. I have seen this bug as well when playing with undo/redo in region. Thanks. (defun undo-tree--primitive-undo (n list) "Undo N records from the front of the list LIST. Return what remains of the list." (let ((arg n) ;; In a writable buffer, enable undoing read-only text that is ;; so because of text properties. (inhibit-read-only t) ;; Don't let `intangible' properties interfere with undo. (inhibit-point-motion-hooks t) ;; We use oldlist only to check for EQ. ++kfs (oldlist buffer-undo-list) (did-apply nil) (next nil) (window-of-current-buffer (get-buffer-window (current-buffer))) (selected-window (selected-window))) (while (> arg 0) (while (setq next (pop list)) ;Exit inner loop at undo boundary. ;; Handle an integer by setting point to that value. (pcase next ((pred integerp) (goto-char next) (unless (eq window-of-current-buffer selected-window) (set-window-point window-of-current-buffer next))) ;; Element (t . TIME) records previous modtime. ;; Preserve any flag of NONEXISTENT_MODTIME_NSECS or ;; UNKNOWN_MODTIME_NSECS. (`(t . ,time) ;; If this records an obsolete save ;; (not matching the actual disk file) ;; then don't mark unmodified. (when (or (equal time (visited-file-modtime)) (and (consp time) (equal (list (car time) (cdr time)) (visited-file-modtime)))) (when (fboundp 'unlock-buffer) (unlock-buffer)) (set-buffer-modified-p nil))) ;; Element (nil PROP VAL BEG . END) is property change. (`(nil . ,(or `(,prop ,val ,beg . ,end) pcase--dontcare)) (when (or (> (point-min) beg) (< (point-max) end)) (let ((debug-on-quit nil) (msg (concat "undo-tree--primative-undo (1 of 4):" " " "Changes to be undone are outside visible portion of buffer."))) (signal 'quit `(,msg)))) (put-text-property beg end prop val)) ;; Element (BEG . END) means range was inserted. (`(,(and beg (pred integerp)) . ,(and end (pred integerp))) ;; (and `(,beg . ,end) `(,(pred integerp) . ,(pred integerp))) ;; Ideally: `(,(pred integerp beg) . ,(pred integerp end)) (when (or (> (point-min) beg) (< (point-max) end)) (let ((debug-on-quit nil) (msg (concat "undo-tree--primative-undo (2 of 4):" " " "Changes to be undone are outside visible portion of buffer."))) (signal 'quit `(,msg)))) ;; Set point first thing, so that undoing this undo ;; does not send point back to where it is now. (goto-char beg) (delete-region beg end) (unless (eq window-of-current-buffer selected-window) (set-window-point window-of-current-buffer beg))) ;; Element (apply FUN . ARGS) means call FUN to undo. (`(apply . ,fun-args) (let ((currbuff (current-buffer))) (if (integerp (car fun-args)) ;; Long format: (apply DELTA START END FUN . ARGS). (pcase-let* ((`(,delta ,start ,end ,fun . ,args) fun-args) (start-mark (copy-marker start nil)) (end-mark (copy-marker end t))) (when (or (> (point-min) start) (< (point-max) end)) (let ((debug-on-quit nil) (msg (concat "undo-tree--primative-undo (3 of 4):" " " "Changes to be undone are outside visible portion of buffer."))) (signal 'quit `(,msg)))) (apply fun args) ;; Use `save-current-buffer'? ;; Check that the function did what the entry ;; said it would do. (unless (and (= start start-mark) (= (+ delta end) end-mark)) (error "Changes to be undone by function different than announced")) (set-marker start-mark nil) (set-marker end-mark nil)) (apply fun-args)) (unless (eq currbuff (current-buffer)) (error "Undo function switched buffer")) (setq did-apply t))) ;; Element (STRING . POS) means STRING was deleted. (`(,(and string (pred stringp)) . ,(and pos (pred integerp))) (when (let ((apos (abs pos))) (or (< apos (point-min)) (> apos (point-max)))) (let ((debug-on-quit nil) (msg (concat "undo-tree--primative-undo (4 of 4):" " " "Changes to be undone are outside visible portion of buffer."))) (signal 'quit `(,msg)))) (let (valid-marker-adjustments) ;; Check that marker adjustments which were recorded ;; with the (STRING . POS) record are still valid, ie ;; the markers haven't moved. We check their validity ;; before reinserting the string so as we don't need to ;; mind marker insertion-type. (while (and (markerp (car-safe (car list))) (integerp (cdr-safe (car list)))) (let* ((marker-adj (pop list)) (m (car marker-adj))) (and (eq (marker-buffer m) (current-buffer)) (= pos m) (push marker-adj valid-marker-adjustments)))) ;; Insert string and adjust point (if (< pos 0) (progn (goto-char (- pos)) (insert string)) (goto-char pos) (insert string) (goto-char pos)) (unless (eq window-of-current-buffer selected-window) (set-window-point window-of-current-buffer pos)) ;; Adjust the valid marker adjustments (dolist (adj valid-marker-adjustments) (set-marker (car adj) (- (car adj) (cdr adj)))))) ;; (MARKER . OFFSET) means a marker MARKER was adjusted by OFFSET. (`(,(and marker (pred markerp)) . ,(and offset (pred integerp))) (let ((msg (concat "undo-tree--primitive-undo: " (format "Encountered %S entry in undo list with no matching (TEXT . POS) entry" next)))) (message msg)) ;; Even though these elements are not expected in the undo ;; list, adjust them to be conservative for the 24.4 ;; release. (Bug#16818) (when (marker-buffer marker) (set-marker marker (- marker offset) (marker-buffer marker)))) (_ (if (eq next 'undo-tree-canary) (message "undo-tree--primitive-undo: catch-all found `%s'." next) (error "Unrecognized entry in undo list %S" next))))) (setq arg (1- arg))) ;; Make sure an apply entry produces at least one undo entry, ;; so the test in `undo' for continuing an undo series ;; will work right. (if (and did-apply (eq oldlist buffer-undo-list)) (setq buffer-undo-list (cons (list 'apply 'cdr nil) buffer-undo-list)))) list) From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 06 01:01:22 2017 Received: (at 16377) by debbugs.gnu.org; 6 Jul 2017 05:01:22 +0000 Received: from localhost ([127.0.0.1]:54046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSyun-00059G-UJ for submit@debbugs.gnu.org; Thu, 06 Jul 2017 01:01:22 -0400 Received: from gateway23.websitewelcome.com ([192.185.49.219]:12869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSyul-000597-3t for 16377@debbugs.gnu.org; Thu, 06 Jul 2017 01:01:20 -0400 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 47EE2284BF for <16377@debbugs.gnu.org>; Thu, 6 Jul 2017 00:01:18 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id SyuAdFsl30E7jSyuBdDndF; Thu, 06 Jul 2017 00:00:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=YzujTtLdAY8OXT/Hh/NeD2zrS2esgm8DlxkneVv4yUw=; b=lFaXLx4VxzmDYp4TLJSEW6hKCa 1hdATGvLpntOY/otGBqn7Nh/ZxOnBvuI3xWbFCpnlVHHQtbd6saijeryWiPiDehBGrlS3R/SgFZ2G QfaLjPUp8mPpDKG5kJfuWEhE94x8VpVdgqbl4P2C3AGQDmdI2whLRWVGXyLDNF0oyYRi4qDBw818Z fYLEc80Y19wx6ahJdXVJ3DC6v9vsTUAzi+jgisKAZbA1glHSoK5i8rpLPSwxtgmQxh1hzQC1Ie51F bloOl5lokrAwTWwpXANOsGZvFKCbIP/OoyCK6Ca5r65EK9ajNdRZT3n/iQ/vzVKwMALPXW4FTPCzw VoUR6sMg==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:59471 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1dSyuj-003r29-CB; Thu, 06 Jul 2017 00:01:17 -0500 Date: Wed, 05 Jul 2017 22:01:16 -0700 Message-ID: From: Keith David Bershatsky To: Stefan Monnier Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Wed_Jul__5_22:01:16_2017-1" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1dSyuj-003r29-CB X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:59471 X-Source-Auth: lawlist X-Email-Count: 3 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16377 Cc: 16377@debbugs.gnu.org, Barry OReilly , Toby Cubitt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --Multipart_Wed_Jul__5_22:01:16_2017-1 Content-Type: text/plain; charset=US-ASCII Thank you, Stefan, for taking another look at #16377. The attached `patch.diff` relates to the modified version of `primitive-undo` that I am using in-house. It applies to the latest version of the master branch (downloaded today 07/05/2017) bearing commit 7a0170de20fe1225d3eeac099d1e61a0c0410bf3. It looks like the revision for bug#25599 was applied by the Emacs team sometime after I made my revised version -- I've never tried using that revised section of code. Keith ;;;;;;;;;;;;;;;;;;;;;;; PREVIOUS MESSAGE ;;;;;;;;;;;;;;;;;;;;;; DATE: [07-05-2017 21:06:50] <06 Jul 2017 00:06:50 -0400> FROM: Stefan Monnier > > > I am presently using the following modified version of primitive-undo in my > [...] > > Please send it as a patch, so we get to see what you've changed, > I don't know about you, but I personally do not remember the current > code of primitive-undo by heart. > > > Stefan ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --Multipart_Wed_Jul__5_22:01:16_2017-1 Content-Type: application/diff; type=patch Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3Avc2ltcGxlLmVsIGIvbGlzcC9zaW1wbGUuZWwKaW5kZXggMWRiMTRh OC4uOWUxMzAxZiAxMDA2NDQKLS0tIGEvbGlzcC9zaW1wbGUuZWwKKysrIGIvbGlzcC9zaW1wbGUu ZWwKQEAgLTI1MTEsMTIgKzI1MTEsMTcgQEAgUmV0dXJuIHdoYXQgcmVtYWlucyBvZiB0aGUgbGlz dC4iCiAgICAgICAgIDs7IFdlIHVzZSBvbGRsaXN0IG9ubHkgdG8gY2hlY2sgZm9yIEVRLiAgKytr ZnMKICAgICAgICAgKG9sZGxpc3QgYnVmZmVyLXVuZG8tbGlzdCkKICAgICAgICAgKGRpZC1hcHBs eSBuaWwpCi0gICAgICAgIChuZXh0IG5pbCkpCisgICAgICAgIChuZXh0IG5pbCkKKyAgICAgICAg KHdpbmRvdy1vZi1jdXJyZW50LWJ1ZmZlciAoZ2V0LWJ1ZmZlci13aW5kb3cgKGN1cnJlbnQtYnVm ZmVyKSkpCisgICAgICAgIChzZWxlY3RlZC13aW5kb3cgKHNlbGVjdGVkLXdpbmRvdykpKQogICAg ICh3aGlsZSAoPiBhcmcgMCkKICAgICAgICh3aGlsZSAoc2V0cSBuZXh0IChwb3AgbGlzdCkpICAg ICA7RXhpdCBpbm5lciBsb29wIGF0IHVuZG8gYm91bmRhcnkuCiAgICAgICAgIDs7IEhhbmRsZSBh biBpbnRlZ2VyIGJ5IHNldHRpbmcgcG9pbnQgdG8gdGhhdCB2YWx1ZS4KICAgICAgICAgKHBjYXNl IG5leHQKLSAgICAgICAgICAoKHByZWQgaW50ZWdlcnApIChnb3RvLWNoYXIgbmV4dCkpCisgICAg ICAgICAgKChwcmVkIGludGVnZXJwKQorICAgICAgICAgICAgKGdvdG8tY2hhciBuZXh0KQorICAg ICAgICAgICAgICAodW5sZXNzIChlcSB3aW5kb3ctb2YtY3VycmVudC1idWZmZXIgc2VsZWN0ZWQt d2luZG93KQorICAgICAgICAgICAgICAgIChzZXQtd2luZG93LXBvaW50IHdpbmRvdy1vZi1jdXJy ZW50LWJ1ZmZlciBuZXh0KSkpCiAgICAgICAgICAgOzsgRWxlbWVudCAodCAuIFRJTUUpIHJlY29y ZHMgcHJldmlvdXMgbW9kdGltZS4KICAgICAgICAgICA7OyBQcmVzZXJ2ZSBhbnkgZmxhZyBvZiBO T05FWElTVEVOVF9NT0RUSU1FX05TRUNTIG9yCiAgICAgICAgICAgOzsgVU5LTk9XTl9NT0RUSU1F X05TRUNTLgpAQCAtMjUyNCwyOCArMjUyOSwzOSBAQCBSZXR1cm4gd2hhdCByZW1haW5zIG9mIHRo ZSBsaXN0LiIKICAgICAgICAgICAgOzsgSWYgdGhpcyByZWNvcmRzIGFuIG9ic29sZXRlIHNhdmUK ICAgICAgICAgICAgOzsgKG5vdCBtYXRjaGluZyB0aGUgYWN0dWFsIGRpc2sgZmlsZSkKICAgICAg ICAgICAgOzsgdGhlbiBkb24ndCBtYXJrIHVubW9kaWZpZWQuCi0gICAgICAgICAgICh3aGVuIChv ciAoZXF1YWwgdGltZSAodmlzaXRlZC1maWxlLW1vZHRpbWUpKQotICAgICAgICAgICAgICAgICAg ICAgKGFuZCAoY29uc3AgdGltZSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgKGVxdWFsIChs aXN0IChjYXIgdGltZSkgKGNkciB0aW1lKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICh2aXNpdGVkLWZpbGUtbW9kdGltZSkpKSkKLSAgICAgICAgICAgICAod2hlbiAoZmJvdW5k cCAndW5sb2NrLWJ1ZmZlcikKLSAgICAgICAgICAgICAgICh1bmxvY2stYnVmZmVyKSkKLSAgICAg ICAgICAgICAoc2V0LWJ1ZmZlci1tb2RpZmllZC1wIG5pbCkpKQorICAgICAgICAgICAgKHdoZW4g KG9yIChlcXVhbCB0aW1lICh2aXNpdGVkLWZpbGUtbW9kdGltZSkpCisgICAgICAgICAgICAgICAg ICAgICAgKGFuZCAoY29uc3AgdGltZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIChlcXVh bCAobGlzdCAoY2FyIHRpbWUpIChjZHIgdGltZSkpICh2aXNpdGVkLWZpbGUtbW9kdGltZSkpKSkK KyAgICAgICAgICAgICAgKHdoZW4gKGZib3VuZHAgJ3VubG9jay1idWZmZXIpCisgICAgICAgICAg ICAgICAgKHVubG9jay1idWZmZXIpKQorICAgICAgICAgICAgICAoc2V0LWJ1ZmZlci1tb2RpZmll ZC1wIG5pbCkpKQogICAgICAgICAgIDs7IEVsZW1lbnQgKG5pbCBQUk9QIFZBTCBCRUcgLiBFTkQp IGlzIHByb3BlcnR5IGNoYW5nZS4KICAgICAgICAgICAoYChuaWwgLiAsKG9yIGAoLHByb3AgLHZh bCAsYmVnIC4gLGVuZCkgcGNhc2UtLWRvbnRjYXJlKSkKLSAgICAgICAgICAgKHdoZW4gKG9yICg+ IChwb2ludC1taW4pIGJlZykgKDwgKHBvaW50LW1heCkgZW5kKSkKLSAgICAgICAgICAgICAoZXJy b3IgIkNoYW5nZXMgdG8gYmUgdW5kb25lIGFyZSBvdXRzaWRlIHZpc2libGUgcG9ydGlvbiBvZiBi dWZmZXIiKSkKKyAgICAgICAgICAgICh3aGVuIChvciAoPiAocG9pbnQtbWluKSBiZWcpICg8IChw b2ludC1tYXgpIGVuZCkpCisgICAgICAgICAgICAgIChsZXQgKChkZWJ1Zy1vbi1xdWl0IG5pbCkK KyAgICAgICAgICAgICAgICAgICAgKG1zZyAoY29uY2F0CisgICAgICAgICAgICAgICAgICAgICAg ICAgICAidW5kby10cmVlLS1wcmltaXRpdmUtdW5kbyAoMSBvZiA0KToiCisgICAgICAgICAgICAg ICAgICAgICAgICAgICAiICAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ2hhbmdlcyB0 byBiZSB1bmRvbmUgYXJlIG91dHNpZGUgdmlzaWJsZSBwb3J0aW9uIG9mIGJ1ZmZlci4iKSkpCisg ICAgICAgICAgICAgICAgKHNpZ25hbCAncXVpdCBgKCxtc2cpKSkpCiAgICAgICAgICAgIChwdXQt dGV4dC1wcm9wZXJ0eSBiZWcgZW5kIHByb3AgdmFsKSkKICAgICAgICAgICA7OyBFbGVtZW50IChC RUcgLiBFTkQpIG1lYW5zIHJhbmdlIHdhcyBpbnNlcnRlZC4KICAgICAgICAgICAoYCgsKGFuZCBi ZWcgKHByZWQgaW50ZWdlcnApKSAuICwoYW5kIGVuZCAocHJlZCBpbnRlZ2VycCkpKQogICAgICAg ICAgICA7OyAoYW5kIGAoLGJlZyAuICxlbmQpIGAoLChwcmVkIGludGVnZXJwKSAuICwocHJlZCBp bnRlZ2VycCkpKQogICAgICAgICAgICA7OyBJZGVhbGx5OiBgKCwocHJlZCBpbnRlZ2VycCBiZWcp IC4gLChwcmVkIGludGVnZXJwIGVuZCkpCi0gICAgICAgICAgICh3aGVuIChvciAoPiAocG9pbnQt bWluKSBiZWcpICg8IChwb2ludC1tYXgpIGVuZCkpCi0gICAgICAgICAgICAgKGVycm9yICJDaGFu Z2VzIHRvIGJlIHVuZG9uZSBhcmUgb3V0c2lkZSB2aXNpYmxlIHBvcnRpb24gb2YgYnVmZmVyIikp CisgICAgICAgICAgICAod2hlbiAob3IgKD4gKHBvaW50LW1pbikgYmVnKSAoPCAocG9pbnQtbWF4 KSBlbmQpKQorICAgICAgICAgICAgICAobGV0ICgoZGVidWctb24tcXVpdCBuaWwpCisgICAgICAg ICAgICAgICAgICAgIChtc2cgKGNvbmNhdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgInVu ZG8tdHJlZS0tcHJpbWl0aXZlLXVuZG8gKDIgb2YgNCk6IgorICAgICAgICAgICAgICAgICAgICAg ICAgICAgIiAgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNoYW5nZXMgdG8gYmUgdW5k b25lIGFyZSBvdXRzaWRlIHZpc2libGUgcG9ydGlvbiBvZiBidWZmZXIuIikpKQorICAgICAgICAg ICAgICAgIChzaWduYWwgJ3F1aXQgYCgsbXNnKSkpKQogICAgICAgICAgICA7OyBTZXQgcG9pbnQg Zmlyc3QgdGhpbmcsIHNvIHRoYXQgdW5kb2luZyB0aGlzIHVuZG8KICAgICAgICAgICAgOzsgZG9l cyBub3Qgc2VuZCBwb2ludCBiYWNrIHRvIHdoZXJlIGl0IGlzIG5vdy4KICAgICAgICAgICAgKGdv dG8tY2hhciBiZWcpCi0gICAgICAgICAgIChkZWxldGUtcmVnaW9uIGJlZyBlbmQpKQorICAgICAg ICAgICAoZGVsZXRlLXJlZ2lvbiBiZWcgZW5kKQorICAgICAgICAgICAodW5sZXNzIChlcSB3aW5k b3ctb2YtY3VycmVudC1idWZmZXIgc2VsZWN0ZWQtd2luZG93KQorICAgICAgICAgICAgIChzZXQt d2luZG93LXBvaW50IHdpbmRvdy1vZi1jdXJyZW50LWJ1ZmZlciBiZWcpKSkKICAgICAgICAgICA7 OyBFbGVtZW50IChhcHBseSBGVU4gLiBBUkdTKSBtZWFucyBjYWxsIEZVTiB0byB1bmRvLgogICAg ICAgICAgIChgKGFwcGx5IC4gLGZ1bi1hcmdzKQogICAgICAgICAgICAobGV0ICgoY3VycmJ1ZmYg KGN1cnJlbnQtYnVmZmVyKSkpCkBAIC0yNTU0LDggKzI1NzAsMTMgQEAgUmV0dXJuIHdoYXQgcmVt YWlucyBvZiB0aGUgbGlzdC4iCiAgICAgICAgICAgICAgICAgIChwY2FzZS1sZXQqICgoYCgsZGVs dGEgLHN0YXJ0ICxlbmQgLGZ1biAuICxhcmdzKSBmdW4tYXJncykKICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIChzdGFydC1tYXJrIChjb3B5LW1hcmtlciBzdGFydCBuaWwpKQogICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKGVuZC1tYXJrIChjb3B5LW1hcmtlciBlbmQgdCkpKQot ICAgICAgICAgICAgICAgICAgICh3aGVuIChvciAoPiAocG9pbnQtbWluKSBzdGFydCkgKDwgKHBv aW50LW1heCkgZW5kKSkKLSAgICAgICAgICAgICAgICAgICAgIChlcnJvciAiQ2hhbmdlcyB0byBi ZSB1bmRvbmUgYXJlIG91dHNpZGUgdmlzaWJsZSBwb3J0aW9uIG9mIGJ1ZmZlciIpKQorICAgICAg ICAgICAgICAgICAgICAod2hlbiAob3IgKD4gKHBvaW50LW1pbikgc3RhcnQpICg8IChwb2ludC1t YXgpIGVuZCkpCisgICAgICAgICAgICAgIChsZXQgKChkZWJ1Zy1vbi1xdWl0IG5pbCkKKyAgICAg ICAgICAgICAgICAgICAgKG1zZyAoY29uY2F0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAi dW5kby10cmVlLS1wcmltaXRpdmUtdW5kbyAoMyBvZiA0KToiCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAiICAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ2hhbmdlcyB0byBiZSB1 bmRvbmUgYXJlIG91dHNpZGUgdmlzaWJsZSBwb3J0aW9uIG9mIGJ1ZmZlci4iKSkpCisgICAgICAg ICAgICAgICAgKHNpZ25hbCAncXVpdCBgKCxtc2cpKSkpCiAgICAgICAgICAgICAgICAgICAgKGFw cGx5IGZ1biBhcmdzKSA7OyBVc2UgYHNhdmUtY3VycmVudC1idWZmZXInPwogICAgICAgICAgICAg ICAgICAgIDs7IENoZWNrIHRoYXQgdGhlIGZ1bmN0aW9uIGRpZCB3aGF0IHRoZSBlbnRyeQogICAg ICAgICAgICAgICAgICAgIDs7IHNhaWQgaXQgd291bGQgZG8uCkBAIC0yNTcxLDggKzI1OTIsMTMg QEAgUmV0dXJuIHdoYXQgcmVtYWlucyBvZiB0aGUgbGlzdC4iCiAgICAgICAgICAgOzsgRWxlbWVu dCAoU1RSSU5HIC4gUE9TKSBtZWFucyBTVFJJTkcgd2FzIGRlbGV0ZWQuCiAgICAgICAgICAgKGAo LChhbmQgc3RyaW5nIChwcmVkIHN0cmluZ3ApKSAuICwoYW5kIHBvcyAocHJlZCBpbnRlZ2VycCkp KQogICAgICAgICAgICAod2hlbiAobGV0ICgoYXBvcyAoYWJzIHBvcykpKQotICAgICAgICAgICAg ICAgICAgIChvciAoPCBhcG9zIChwb2ludC1taW4pKSAoPiBhcG9zIChwb2ludC1tYXgpKSkpCi0g ICAgICAgICAgICAgKGVycm9yICJDaGFuZ2VzIHRvIGJlIHVuZG9uZSBhcmUgb3V0c2lkZSB2aXNp YmxlIHBvcnRpb24gb2YgYnVmZmVyIikpCisgICAgICAgICAgICAgICAgICAgIChvciAoPCBhcG9z IChwb2ludC1taW4pKSAoPiBhcG9zIChwb2ludC1tYXgpKSkpCisgICAgICAgICAgICAgIChsZXQg KChkZWJ1Zy1vbi1xdWl0IG5pbCkKKyAgICAgICAgICAgICAgICAgICAgKG1zZyAoY29uY2F0Cisg ICAgICAgICAgICAgICAgICAgICAgICAgICAidW5kby10cmVlLS1wcmltaXRpdmUtdW5kbyAoNCBv ZiA0KToiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAiICAiCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAiQ2hhbmdlcyB0byBiZSB1bmRvbmUgYXJlIG91dHNpZGUgdmlzaWJsZSBwb3J0 aW9uIG9mIGJ1ZmZlci4iKSkpCisgICAgICAgICAgICAgICAgKHNpZ25hbCAncXVpdCBgKCxtc2cp KSkpCiAgICAgICAgICAgIChsZXQgKHZhbGlkLW1hcmtlci1hZGp1c3RtZW50cykKICAgICAgICAg ICAgICA7OyBDaGVjayB0aGF0IG1hcmtlciBhZGp1c3RtZW50cyB3aGljaCB3ZXJlIHJlY29yZGVk CiAgICAgICAgICAgICAgOzsgd2l0aCB0aGUgKFNUUklORyAuIFBPUykgcmVjb3JkIGFyZSBzdGls bCB2YWxpZCwgaWUKQEAgLTI1OTQsMTggKzI2MjAsMjAgQEAgUmV0dXJuIHdoYXQgcmVtYWlucyBv ZiB0aGUgbGlzdC4iCiAgICAgICAgICAgICAgICAoZ290by1jaGFyIHBvcykKICAgICAgICAgICAg ICAgIChpbnNlcnQgc3RyaW5nKQogICAgICAgICAgICAgICAgKGdvdG8tY2hhciBwb3MpKQorICAg ICAgICAgICAgICh1bmxlc3MgKGVxIHdpbmRvdy1vZi1jdXJyZW50LWJ1ZmZlciBzZWxlY3RlZC13 aW5kb3cpCisgICAgICAgICAgICAgICAoc2V0LXdpbmRvdy1wb2ludCB3aW5kb3ctb2YtY3VycmVu dC1idWZmZXIgcG9zKSkKICAgICAgICAgICAgICA7OyBBZGp1c3QgdGhlIHZhbGlkIG1hcmtlciBh ZGp1c3RtZW50cwogICAgICAgICAgICAgIChkb2xpc3QgKGFkaiB2YWxpZC1tYXJrZXItYWRqdXN0 bWVudHMpCi0gICAgICAgICAgICAgICA7OyBJbnNlcnQgbWlnaHQgaGF2ZSBpbnZhbGlkYXRlZCBz b21lIG9mIHRoZSBtYXJrZXJzCi0gICAgICAgICAgICAgICA7OyB2aWEgbW9kaWZpY2F0aW9uIGhv b2tzLiAgVXBkYXRlIG9ubHkgdGhlIGN1cnJlbnRseQotICAgICAgICAgICAgICAgOzsgdmFsaWQg b25lcyAoYnVnIzI1NTk5KS4KLSAgICAgICAgICAgICAgIChpZiAobWFya2VyLWJ1ZmZlciAoY2Fy IGFkaikpCi0gICAgICAgICAgICAgICAgICAgKHNldC1tYXJrZXIgKGNhciBhZGopCi0gICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKC0gKGNhciBhZGopIChjZHIgYWRqKSkpKSkpKQorICAg ICAgICAgICAgICAgKHNldC1tYXJrZXIgKGNhciBhZGopCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAoLSAoY2FyIGFkaikgKGNkciBhZGopKSkpKSkKICAgICAgICAgICA7OyAoTUFSS0VSIC4g T0ZGU0VUKSBtZWFucyBhIG1hcmtlciBNQVJLRVIgd2FzIGFkanVzdGVkIGJ5IE9GRlNFVC4KICAg ICAgICAgICAoYCgsKGFuZCBtYXJrZXIgKHByZWQgbWFya2VycCkpIC4gLChhbmQgb2Zmc2V0IChw cmVkIGludGVnZXJwKSkpCi0gICAgICAgICAgICh3YXJuICJFbmNvdW50ZXJlZCAlUyBlbnRyeSBp biB1bmRvIGxpc3Qgd2l0aCBubyBtYXRjaGluZyAoVEVYVCAuIFBPUykgZW50cnkiCi0gICAgICAg ICAgICAgICAgIG5leHQpCisgICAgICAgICAgICAobGV0ICgobXNnCisgICAgICAgICAgICAgICAg ICAgIChjb25jYXQKKyAgICAgICAgICAgICAgICAgICAgICAidW5kby10cmVlLS1wcmltaXRpdmUt dW5kbzogICIKKyAgICAgICAgICAgICAgICAgICAgICAoZm9ybWF0ICJFbmNvdW50ZXJlZCAlUyBl bnRyeSBpbiB1bmRvIGxpc3Qgd2l0aCBubyBtYXRjaGluZyAoVEVYVCAuIFBPUykgZW50cnkiCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXh0KSkpKQorICAgICAgICAgICAgICAobWVz c2FnZSBtc2cpKQogICAgICAgICAgICA7OyBFdmVuIHRob3VnaCB0aGVzZSBlbGVtZW50cyBhcmUg bm90IGV4cGVjdGVkIGluIHRoZSB1bmRvCiAgICAgICAgICAgIDs7IGxpc3QsIGFkanVzdCB0aGVt IHRvIGJlIGNvbnNlcnZhdGl2ZSBmb3IgdGhlIDI0LjQKICAgICAgICAgICAgOzsgcmVsZWFzZS4g IChCdWcjMTY4MTgpCkBAIC0yNjEzLDcgKzI2NDEsMTAgQEAgUmV0dXJuIHdoYXQgcmVtYWlucyBv ZiB0aGUgbGlzdC4iCiAgICAgICAgICAgICAgKHNldC1tYXJrZXIgbWFya2VyCiAgICAgICAgICAg ICAgICAgICAgICAgICAgKC0gbWFya2VyIG9mZnNldCkKICAgICAgICAgICAgICAgICAgICAgICAg ICAobWFya2VyLWJ1ZmZlciBtYXJrZXIpKSkpCi0gICAgICAgICAgKF8gKGVycm9yICJVbnJlY29n bml6ZWQgZW50cnkgaW4gdW5kbyBsaXN0ICVTIiBuZXh0KSkpKQorICAgICAgICAgIChfCisgICAg ICAgICAgICAoaWYgKGVxIG5leHQgJ3VuZG8tdHJlZS1jYW5hcnkpCisgICAgICAgICAgICAgICht ZXNzYWdlICJ1bmRvLXRyZWUtLXByaW1pdGl2ZS11bmRvOiAgY2F0Y2gtYWxsIGZvdW5kIGAlcycu IiBuZXh0KQorICAgICAgICAgICAgICAoZXJyb3IgIlVucmVjb2duaXplZCBlbnRyeSBpbiB1bmRv IGxpc3QgJVMiIG5leHQpKSkpKQogICAgICAgKHNldHEgYXJnICgxLSBhcmcpKSkKICAgICA7OyBN YWtlIHN1cmUgYW4gYXBwbHkgZW50cnkgcHJvZHVjZXMgYXQgbGVhc3Qgb25lIHVuZG8gZW50cnks CiAgICAgOzsgc28gdGhlIHRlc3QgaW4gYHVuZG8nIGZvciBjb250aW51aW5nIGFuIHVuZG8gc2Vy aWVzCg== --Multipart_Wed_Jul__5_22:01:16_2017-1-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 06 01:35:59 2017 Received: (at 16377) by debbugs.gnu.org; 6 Jul 2017 05:35:59 +0000 Received: from localhost ([127.0.0.1]:54059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSzSI-00067g-QY for submit@debbugs.gnu.org; Thu, 06 Jul 2017 01:35:59 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:43290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSzSG-00067W-H9 for 16377@debbugs.gnu.org; Thu, 06 Jul 2017 01:35:57 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v665ZshK000307; Thu, 6 Jul 2017 01:35:55 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 9268066273; Thu, 6 Jul 2017 01:35:54 -0400 (EDT) From: Stefan Monnier To: Keith David Bershatsky Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: References: Date: Thu, 06 Jul 2017 01:35:54 -0400 In-Reply-To: (Keith David Bershatsky's message of "Wed, 05 Jul 2017 22:01:16 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6064=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6064> : inlines <5963> : streams <1752971> : uri <2457041> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 16377 Cc: 16377@debbugs.gnu.org, Barry OReilly , Toby Cubitt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > + (window-of-current-buffer (get-buffer-window (current-buffer))) > + (selected-window (selected-window))) [...] > + (unless (eq window-of-current-buffer selected-window) Better check (eq (window-buffer) (current-buffer)), since these two functions are mere accessors, whereas get-buffer-window is a funny function which returns *one of* the buffer's windows (or nil) and is hence both more costly (it has a loop inside) and less reliable. > - (when (or (> (point-min) beg) (< (point-max) end)) > - (error "Changes to be undone are outside visible portion of buffer")) > + (when (or (> (point-min) beg) (< (point-max) end)) > + (let ((debug-on-quit nil) > + (msg (concat > + "undo-tree--primitive-undo (1 of 4):" > + " " > + "Changes to be undone are outside visible portion of buffer."))) > + (signal 'quit `(,msg)))) Not sure what is the benefit of signaling `quit` rather than `error`. Can you expand on that? > - ;; Insert might have invalidated some of the markers > - ;; via modification hooks. Update only the currently > - ;; valid ones (bug#25599). > - (if (marker-buffer (car adj)) > - (set-marker (car adj) > - (- (car adj) (cdr adj))))))) > + (set-marker (car adj) > + (- (car adj) (cdr adj)))))) IIUC, this is an unintended change in your code, right? > ;; (MARKER . OFFSET) means a marker MARKER was adjusted by OFFSET. > (`(,(and marker (pred markerp)) . ,(and offset (pred integerp))) > - (warn "Encountered %S entry in undo list with no matching (TEXT . POS) entry" > - next) > + (let ((msg > + (concat > + "undo-tree--primitive-undo: " > + (format "Encountered %S entry in undo list with no matching (TEXT . POS) entry" > + next)))) > + (message msg)) What is this change meant to do? > + (_ > + (if (eq next 'undo-tree-canary) > + (message "undo-tree--primitive-undo: catch-all found `%s'." next) > + (error "Unrecognized entry in undo list %S" next))))) This might make sense to work around the problem, but is clearly not an actual fix. IIUC Tony said it looked like a bug in undo-tree. Has there been any progress on finding/fixing the bug there? What is this "canary" meant to do? If it shouldn't signal an error here, maybe rather than the constant `undo-tree-canary`, undo-tree should use another constant value, i.e. one that is a valid (and harmless) undo entry. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 06 02:27:25 2017 Received: (at 16377) by debbugs.gnu.org; 6 Jul 2017 06:27:25 +0000 Received: from localhost ([127.0.0.1]:54103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT0G5-0007LY-DM for submit@debbugs.gnu.org; Thu, 06 Jul 2017 02:27:25 -0400 Received: from gateway32.websitewelcome.com ([192.185.145.113]:35738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT0G4-0007LQ-1b for 16377@debbugs.gnu.org; Thu, 06 Jul 2017 02:27:24 -0400 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway32.websitewelcome.com (Postfix) with ESMTP id C94A64584B3 for <16377@debbugs.gnu.org>; Thu, 6 Jul 2017 01:25:11 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id T0DZdWBkOUy7vT0DZdZV9s; Thu, 06 Jul 2017 01:24:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=e9Gw06MmPLyV/EldD/NkDJtCe5HYKDasNKnMlxOIeCI=; b=YEEFLTBT1XjH/Nhyrinunzwpkp wYZwn0oumKC0Nx9R3+fxW5QI5pkMwsef3wIqOCkC2yZZ08Te3DPABkNIaF4fXA2F/VfpEdox5iqd9 DY6Lh3s/er2dTdDfgiIXVjXl6TZMVBL3/WEUPbwoc3SvDRmVmPylDNw/l2B32F+lJckW9asiFnSfv /xQkvZZD4pzcaagL/HlrpGo+3v587c35ONRRa44/ddymAjBV2+Y5wc8lv7u/bTmaw/PDme4sePRAt bdgdblX747BWQ5wkY9lSQlpIFo36L57nCkCmcwWPXo0HCrYKYywIlLSyyaNbzKurbaLzj6rYgpLNs WGPgi0RA==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:60164 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1dT0Dv-000pJ3-19; Thu, 06 Jul 2017 01:25:11 -0500 Date: Wed, 05 Jul 2017 23:25:10 -0700 Message-ID: From: Keith David Bershatsky To: Stefan Monnier Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1dT0Dv-000pJ3-19 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:60164 X-Source-Auth: lawlist X-Email-Count: 3 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 16377 Cc: 16377@debbugs.gnu.org, Barry OReilly , Toby Cubitt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Thank you for the helpful critique to substitute `window-buffer` for `get-window-buffer`. I like to keep `debug-on-error` always set to `t`, and known situations I generally limit to showing me just a message in the echo area with the name of the function that generated it. That's why I've been using the `quit` signal instead of popping open a `*Backrace*` buffer for familiar situations. The code that the Emacs team implemented in response to bug#25599 is probably fine. I just hadn't seen that before today, and my code predates its implementation. Substituting the `warn` pop-up buffer for a plain old `message` was just a matter of personal preference. Nothing substantive there was intended. The existence and discussion surrounding `undo-tree.el` predates my usage of that library, but from what I can tell, at some point in the past `primitive-undo' was "improved" to start checking for errors and this resulted in bug #16377. From an untrained layman's way of thinking, I am "guessing" that if undo-tree worked fine before `primitive-undo` was modified to throw an error, then perhaps it is not "a problem" with undo-tree except to the extent that undo-tree may need to "evolve" to play nice with the current version of `primitive-undo`. Based on that "optional evolution theory", I created the workaround to just throw an informative message instead of an error. However, I do not know if that approach could lead to problems. I've spent quite a bit of time studying certain sections of the undo-tree.el library, but there are sections of the code that are still "Greek to me". My understanding of the `undo-tree-canary` symbol inside the `buffer-undo-list` is that it is a way for undo-tree to check if it has interacted with the `buffer-undo-list`. If the canary is not there, then handle the situation differently. If the canary is there, then process the `buffer-undo-list` until reaching the canary. It could be any arbitrary symbol so long as it remains at the tail end of the `buffer-undo-list` with a `nil` before it while undo-tree is being used in the buffer. There is only one situation I am aware of where the `undo-tree-canary` disappears, and it happens sometimes with garbage collection (bug #27214). Whatever symbol is used, it needs to remain in the `buffer-undo-list` until `undo-tree-mode` is deactivated. I suppose the design could have been different, but Dr. Cubitt probably had several additiona l reasons for using a constant symbol such as the `undo-tree-canary`. Bug #16377 might very well be resolvable by tweaking/fixing undo-tree.el; however, the undo/redo in region code is still a few light years beyond my present abilities. Keith ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > + (_ > > + (if (eq next 'undo-tree-canary) > > + (message "undo-tree--primitive-undo: catch-all found `%s'." next) > > + (error "Unrecognized entry in undo list %S" next))))) > > This might make sense to work around the problem, but is clearly not an > actual fix. IIUC Tony said it looked like a bug in undo-tree. > Has there been any progress on finding/fixing the bug there? > What is this "canary" meant to do? If it shouldn't signal an error > here, maybe rather than the constant `undo-tree-canary`, undo-tree > should use another constant value, i.e. one that is a valid (and > harmless) undo entry. > > > Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 06 05:47:48 2017 Received: (at 16377) by debbugs.gnu.org; 6 Jul 2017 09:47:49 +0000 Received: from localhost ([127.0.0.1]:54208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT3O0-0005Df-Oj for submit@debbugs.gnu.org; Thu, 06 Jul 2017 05:47:48 -0400 Received: from starfish.geekisp.com ([216.168.135.166]:8102) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT3Nz-0005DR-3T for 16377@debbugs.gnu.org; Thu, 06 Jul 2017 05:47:47 -0400 Received: (qmail 22862 invoked by uid 1003); 6 Jul 2017 09:47:40 -0000 Received: from unknown (HELO marvin.localdomain) (toby@dr-qubit.org@128.16.15.253) by mail.geekisp.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 6 Jul 2017 09:47:40 -0000 Received: by marvin.localdomain (Postfix, from userid 1000) id 7D57A2C5927B; Thu, 6 Jul 2017 10:47:39 +0100 (BST) Date: Thu, 6 Jul 2017 10:47:39 +0100 From: Toby Cubitt To: Keith David Bershatsky Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: <20170706094739.GA21603@marvin.cs.ucl.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170706090256.GA20017@marvin.cs.ucl.ac.uk> X-PGP-Key: http://www.dr-qubit.org/gpg-toby-pub.asc User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16377 Cc: 16377@debbugs.gnu.org, Barry OReilly , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On Thu, Jul 06, 2017 at 10:02:56AM +0100, Toby Cubitt wrote: > I'm way behind on dealing with undo-tree bug reports whilst busy with > "real life". #16377 is a very helpful bug report, which I can now > reproduce much more reliably with current Emacs version than I could when > it was originally reported. I hope to have time for a mammoth undo-tree > maintenance session later this summer. If that works out, I'll look into > it then. Scratch that. I can't reproduce #16377 in Emacs 25.2.1, undo-tree git head, except by calling undo-tree-undo/redo commands via M-x in buffers where undo-tree-mode is disabled. Calling undo-tree commands with undo-tree-mode disabled is entirely expected to mess up buffer-undo-list. I've added checks in git to all the undo-tree interactive commands to throw a user-error if they're called when undo-tree is not enabled, to guard against this. But that has nothing to do with the original bug, which appears to already be fixed in git. Toby -- Dr T. S. Cubitt Royal Society University Research Fellow Quantum Information Theory Department of Computer Science University College London email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 06 11:18:34 2017 Received: (at 16377) by debbugs.gnu.org; 6 Jul 2017 15:18:34 +0000 Received: from localhost ([127.0.0.1]:55299 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT8Y5-0006SQ-Pp for submit@debbugs.gnu.org; Thu, 06 Jul 2017 11:18:34 -0400 Received: from starfish.geekisp.com ([216.168.135.166]:17032) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT2gj-0004De-6a for 16377@debbugs.gnu.org; Thu, 06 Jul 2017 05:03:05 -0400 Received: (qmail 32699 invoked by uid 1003); 6 Jul 2017 09:02:58 -0000 Received: from unknown (HELO marvin.localdomain) (toby@dr-qubit.org@128.16.15.253) by mail.geekisp.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 6 Jul 2017 09:02:58 -0000 Received: by marvin.localdomain (Postfix, from userid 1000) id B30502C58CF5; Thu, 6 Jul 2017 10:02:56 +0100 (BST) Date: Thu, 6 Jul 2017 10:02:56 +0100 From: Toby Cubitt To: Keith David Bershatsky Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary") Message-ID: <20170706090256.GA20017@marvin.cs.ucl.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: http://www.dr-qubit.org/gpg-toby-pub.asc User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 16377 X-Mailman-Approved-At: Thu, 06 Jul 2017 11:18:32 -0400 Cc: 16377@debbugs.gnu.org, Barry OReilly , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On Wed, Jul 05, 2017 at 11:25:10PM -0700, Keith David Bershatsky wrote: > The existence and discussion surrounding `undo-tree.el` predates my > usage of that library, but from what I can tell, at some point in the > past `primitive-undo' was "improved" to start checking for errors and > this resulted in bug #16377. No, the new error checking just helpfully revealed an existing bug in undo-tree's undo-in-region support (which frankly has always been flaky, as it's extraordinarily difficult to reliably reproduce undo bugs). There's even an `undo-tree-enable-undo-in-region' toggle to disable undo-in-region support, for exactly this reason. Probably I should make it default to "off" for now. I'm way behind on dealing with undo-tree bug reports whilst busy with "real life". #16377 is a very helpful bug report, which I can now reproduce much more reliably with current Emacs version than I could when it was originally reported. I hope to have time for a mammoth undo-tree maintenance session later this summer. If that works out, I'll look into it then. > From an untrained layman's way of thinking, I am "guessing" that if > undo-tree worked fine before `primitive-undo` was modified to throw an > error, then perhaps it is not "a problem" with undo-tree except to the > extent that undo-tree may need to "evolve" to play nice with the > current version of `primitive-undo`. The undo-tree-canary symbol should never end up in the list passed by undo-tree to `primitive-undo', so it shouldn't matter whether it throws an error. `primitive-undo' throwing an error on garbage, as in current Emacs, makes complete sense from my perspective. > Based on that "optional evolution theory", I created the workaround to > just throw an informative message instead of an error. However, I do > not know if that approach could lead to problems. I deliberately didn't touch `primitive-undo' in undo-tree. It was a c primitive when I wrote undo-tree, and overriding primitives is not a good idea. Even now, I wouldn't recommend overriding it without rewriting undo-tree so it completely rips out and replaces the Emacs undo system. (If that's even possible -- it didn't used to be because too much was done in c.) As currently implemented, undo-tree sits on top of the standard Emacs undo system and overrides as little as possible. I certainly wouldn't disable the error reporting, since that just masks the bug, it doesn't fix it. > I've spent quite a bit of time studying certain sections of the > undo-tree.el library, but there are sections of the code that are > still "Greek to me". My understanding of the `undo-tree-canary` > symbol inside the `buffer-undo-list` is that it is a way for undo-tree > to check if it has interacted with the `buffer-undo-list`. The *only* purpose of the undo-tree-canary is to detect when Emacs has discarded undo history from buffer-undo-list before undo-tree got to look at it. In that situation, the entire contents of buffer-undo-tree gets discarded (because it only contains undo history that's being discarded), and gets rebuilt afresh from the new contents of buffer-undo-list. > There is only one situation I am aware of where the `undo-tree-canary` > disappears, and it happens sometimes with garbage collection (bug > #27214). Whatever symbol is used, it needs to remain in the > `buffer-undo-list` until `undo-tree-mode` is deactivated. No, it's fine for it to be removed from buffer-undo-list, as long as this only happens when the whole undo history is being discarded. > I suppose the design could have been different, but Dr. Cubitt probably > had several additiona l reasons for using a constant symbol such as the > `undo-tree-canary`. Anything that's an invalid undo entry would do the job. A symbol with the package prefix is the obvious choice. > Bug #16377 might very well be resolvable by tweaking/fixing > undo-tree.el; however, the undo/redo in region code is still a few > light years beyond my present abilities. Unfortunately, it's also always been a few light years beyond my ability to debug :-/ Best, Toby -- Dr T. S. Cubitt Royal Society University Research Fellow Quantum Information Theory Department of Computer Science University College London email: tsc25@cantab.net web: www.dr-qubit.org From unknown Thu Aug 14 18:40:37 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 04 Aug 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator