summaryrefslogtreecommitdiff
path: root/lisp/electric.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-07-14 13:32:23 +0800
committerChong Yidong <cyd@gnu.org>2012-07-14 13:32:23 +0800
commitb5cf7fc45c625b312ab88fb3fa13eef2f25acbce (patch)
treece8e7084fdb0992fd042c7ee02fb1387eed08f2b /lisp/electric.el
parent22e983b7ec9aa42966cda353e3039240279edc1b (diff)
downloademacs-b5cf7fc45c625b312ab88fb3fa13eef2f25acbce.tar.gz
Fix electric-pair-mode/delete-selection-mode interaction.
* lisp/electric.el (electric-pair-post-self-insert-function): Fix pair insertion in empty-region case. Fixes: debbugs:11520
Diffstat (limited to 'lisp/electric.el')
-rw-r--r--lisp/electric.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/electric.el b/lisp/electric.el
index 5f1445577e9..3108a0ed4c0 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -322,12 +322,13 @@ This can be convenient for people who find it easier to hit ) than C-f."
((and (memq syntax '(?\( ?\" ?\$)) (use-region-p))
(if (> (mark) (point))
(goto-char (mark))
- ;; We already inserted the open-paren but at the end of the region,
- ;; so we have to remove it and start over.
- (delete-char -1)
- (save-excursion
+ ;; We already inserted the open-paren but at the end of the
+ ;; region, so we have to remove it and start over.
+ (delete-char -1)
+ (save-excursion
(goto-char (mark))
- (insert last-command-event)))
+ ;; Do not insert after `save-excursion' marker (Bug#11520).
+ (insert-before-markers last-command-event)))
(insert closer))
;; Backslash-escaped: no pairing, no skipping.
((save-excursion