GNU bug report logs - #10047
Looking for help debugging an undo issue

Previous Next

Package: emacs;

Reported by: Phil Sainty <psainty <at> orcon.net.nz>

Date: Mon, 14 Nov 2011 17:32:02 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 10047 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 10047 <at> debbugs.gnu.org
Subject: Re: bug#10047: Looking for help debugging an undo issue
Date: Tue, 29 Nov 2011 15:22:10 -0500
> As it turned out, most of my code & context was irrelevant.
> You should be able to reproduce the bug like this:

> emacs -Q
> M-: (add-hook 'post-command-hook 'align-current) RET
> <backspace> (until the scratch buffer message is gone)
> C-/ (or otherwise undo, until it fails with the message
> "No further undo information")

OK, here's my analysis:
1- align-current uses several (call it M) temporary markers.
2- they all get added to the undo-list whenever you DEL (because their
   position is modified).
3- so after N uses of DEL, you have M * N^2 entries.  In my tests, M is
   10, so after deleting 50 chars, you have 10 * 2500 = 25000
   "marker-update" entries in your undo-log.
4- at the beginning of GC, the log is considered too long (because of
   those spurious entries) and gets truncated.
5- at the end of GC, those spurious entries are removed from the log
   because those markers were temporary and only the undo-log still had
   references to them.

The problem can be fixed in 2 ways, both of which are desired:
- change align.el so it doesn't leave so many temporary markers around
  (it could use fewer markers, and it could also unset them explicitly
  at the end).
- swap 4 and 5 (actually it was swapped in Emacs-22, so that would
  revert to the behavior of Emacs-21).

I've installed a patch which reduces align.el's use of markers a little
bit.  It seems sufficient to get your test case to work, but I can't
guarantee it will solve the problem in your more general case.
It'd take a bit more analysis of align.el's code to figure out how to
fix it further.


        Stefan




This bug report was last modified 12 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.