I have a question about this part: why do you not delete the
overlay when
transient-mark-mode is active?
I guess because the region is still active, so, as normally in
transient-mark-mode, the active region should remain highlighted
until mark
is deactivated, just as in normal selection.
The region highlighting (when transient-mark-mode is ON) is not
done by
mouse-region-overlay, so deleting this overlay shouldn't make
any difference.
Maybe this isn't necessary.
Indeed AFAICT it shouldn't be necessary, which is why I ask.
If the explicit test is placed there only based on a fear of what
might
happen, rather than on actual evidence, then I suggest to remove it.