aquamacs-redo: ensure undo recording happens before delete-selection

Check and fix pre-command-hook if the order is not right.
delsel: delete-active-region: avoid undo boundary

Set last-command so that self-insert-command removes any
undo boundary.