Subject: Re: bug#10047: Looking for help debugging an undo issue

From: Stefan Monnier <[email-masked]>
Date: Fri, 18 Nov 2011 12:36:23 -0500

> I'm a bit stumped, and am not even sure how to approach this.

> I'm writing a major mode for entering timesheet data for use with a
> custom application, and I wanted to keep the columns automatically
> aligned within a block of entries for a given day, so my mode uses
> `post-command-hook' to (most of the time) call `align-current', which
> works more or less as I want* except that I'm encountering situations
> in testing where the undo system forgets some of the history and just
> reports "No further undo information". This is happening when I delete
> a few lines of data, and then try to re-do it all. It gets part way
> through and then fails to re-do the remainder. This is something of a
> show-stopper.

> I'm seeing the same issue with both Emacs 23.3 and 24.0.91.1 on both
> Windows and Ubuntu.

> I'm really not sure how to go about debugging the problem. I was
> hoping that maybe someone can provide some insight into how my use of
> align-current and post-command-hook might affect the undo system, or
> otherwise suggest some smart ways of narrowing down what the problem
> is? I'm really not familiar with the inner workings of the mechanisms
> in question. All I can think of offhand is that (despite the test data
> being only ~200 bytes) I'm managing to exceed the maximum amount of
> undo data permitted, and it's silently losing the data for the older
> changes??

Your problem doesn't ring a bell, sorry.  The best options I can think
of are:
- log the value of buffer-undo-list at each step in some auxiliary
  debugging buffer, for post-mortem analysis.
- try to come up with a reproducible test case.

        Stefan