In rebox2, I do a lot of erasing and recreating box borders, often the new border is exactly the same as the previous. For example if text is pasted into a box, rebox2 will first unbox the region, yank, and rebox. This means that a lot of not very useful changes gets put into the undo-list. With modern machines, it's not a huge concern, but I would like to make this more efficient.
How can I minimize this? For example is there a way to take a snapshot of a region (A) and a new region (B), and create the minimal number of edit steps that gets A->B? Or even better would be if I can leave a marker on the undo-list and say compact undo from now back to the marker.