GNU bug report logs - #14000
24.3.50; electric-pair-post-self-insert-function does not handle nested parentheses

Previous Next

Package: emacs;

Reported by: Carsten Bormann <cabo <at> tzi.org>

Date: Tue, 19 Mar 2013 19:56:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Carsten Bormann <cabo <at> tzi.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
	electric-pair-post-self-insert-function does not handle nested
	parentheses
Date: Tue, 19 Mar 2013 18:59:53 +0100
In electric-pair-mode, I type "(("

I get "(()"

I should get "(())"

Fix below.

In GNU Emacs 24.3.50.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2013-03-19 on bob.porkrind.org
Bzr revision: 112090 dgutov <at> yandex.ru-20130319050649-jie5ixrjvsavih4i
Windowing system distributor `Apple', version 10.3.1187
Configured using:
 `configure --host=x86_64-apple-darwin --build=i686-apple-darwin
 --with-ns'

--- electric.el	2013-03-19 18:51:05.000000000 +0100
+++ electric-fixed.el	2013-03-19 18:55:59.000000000 +0100
@@ -354,7 +354,10 @@
                ;; I find it more often preferable not to pair when the
                ;; same char is next.
                (eq last-command-event (char-after))
-               (eq last-command-event (char-before (1- (point))))
+               (and
+                (eq last-command-event (char-before (1- (point))))
+                (not (eq syntax ?\())
+               )
                ;; I also find it often preferable not to pair next to a word.
                (eq (char-syntax (following-char)) ?w)))
       (save-excursion (insert closer))))))




This bug report was last modified 12 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.