You may provide a PostEvents object, which should provide the methods described below.
The method !!postEvents.postMark will be called every time an undoable is created, after the undoable has been added to the undo stack.
Similarly, the method postUndo will be called after an UNDO has occurred, and so on. Each method will be passed a STRING object containing the name of the mark with which the mark, undo, or redo is associated.