]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix electric-pair-mode/delete-selection-mode interaction.
authorChong Yidong <cyd@gnu.org>
Sat, 14 Jul 2012 05:32:23 +0000 (13:32 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 14 Jul 2012 05:32:23 +0000 (13:32 +0800)
* lisp/electric.el (electric-pair-post-self-insert-function): Fix pair
insertion in empty-region case.

Fixes: debbugs:11520
lisp/ChangeLog
lisp/electric.el

index fb1eae49dba5f576ec14aa561ff4b1d27f9ee18c..15ed6d89943c91cb089300378b8cc26ab2af2bee 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-14  Chong Yidong  <cyd@gnu.org>
+
+       * electric.el (electric-pair-post-self-insert-function): Fix pair
+       insertion in empty-region case (Bug#11520).
+
 2012-07-14  Chong Yidong  <cyd@gnu.org>
 
        * bindings.el: Consolidate ctl-x-r-map bindings.  Bind
index 5f1445577e93bad5ec95846347e86f4e51231ea3..3108a0ed4c0378bc9ab1375a26a54c0620ebd09f 100644 (file)
@@ -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