Subject: Looking for help debugging an undo issue

From: Phil Sainty <[email-masked]>
Date: Mon, 14 Nov 2011 23:52:35 +1300

Hi all,

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??

I've verified that the issue occurs when running emacs with the -Q
option, and loading only the relevant files, although I haven't yet
boiled the code down to a minimal test case. I imagine that's the next
step, if no one has any immediate suggestions, but unfortunately the
bug seems inconsistent in when it occurs, so I've been having some
trouble even trying to do that much.

thanks,

-Phil

(*) I'm finding it trickier than I had hoped to configure the align
rules for this purpose, but that's not relevant here other than to say
that the docstring for the `align-rules-list' variable should detail
the requirement for and use of the (end reverse) arguments for a
custom "regexp" function, because that's not obvious without searching
for example usages and/or reading through the somewhat complex code
in the align library. (The problem I'm having occurs regardless of
whether I'm using a custom function or a plain regexp, however.)