What is the easiest/simplest way to achieve the following: auto-pair parentheses (or other characters) around some text only when this text is an active region?
For example, say I do not want the character
' to trigger auto pairs for the current mode, except when I have selected some text, in which case I want the selected text to be wrapped by two
' by just pressing this key.
I currently use
electric-pair-mode to pair parentheses in
text-mode and in programming modes, but feel free to point out other auto-pair packages or solutions.