I learnt something cool about Emacs undo on a recent HN thread.
If some text is selected before invoking undo, then undo happens only within the selected region.
If some text is selected before invoking undo, then undo happens only within the selected region.