Fix bug with electric-pair-mode

With both electric-pair-mode and delete-selection-mode active, typing an open parenthesis removes the selection (if any) before inserting the () pair, instead of placing the pair around the selection. This patch fixes that problem.

Compare commit 7fe99af6 of the org-mode repository.