> > Thanks a lot (especially for improving the docstring ;-). In my > experience, this part of the code is quite delicate and I wouldn't be > surprised to find yet more bugs for other corner cases. So I think it's > very important to document those corner cases with tests. Any chance > you could add matching tests to test/lisp/simple-tests.el in your patch? > This patch applies on top of the first one. I added more docstrings since you seem to appreciate it. I came up with some simple test cases for ordinary mapping, t and ‘undo-in-region in the table. Do you have other corner cases in mind? I also added some simple test cases for undo in region. I couldn’t wrap my head around the original tests so I started a new one below. Yuan