From unknown Mon Jun 23 23:54:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17192: 24.4.50; python-mode's python-electric-pair-string-delimiter inserts an extra quote Resent-From: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Apr 2014 12:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 17192 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 17192@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.139670056230000 (code B ref -1); Sat, 05 Apr 2014 12:23:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Apr 2014 12:22:42 +0000 Received: from localhost ([127.0.0.1]:36070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWPcP-0007nk-NB for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33527) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWPcM-0007nV-Vy for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWPcD-0004VJ-Qg for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPcD-0004VE-NP for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPc4-0003dj-H9 for bug-gnu-emacs@gnu.org; Sat, 05 Apr 2014 08:22:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWPbv-0004Bo-AX for bug-gnu-emacs@gnu.org; Sat, 05 Apr 2014 08:22:20 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:49751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPbu-00049P-VL for bug-gnu-emacs@gnu.org; Sat, 05 Apr 2014 08:22:11 -0400 Received: by mail-wi0-f169.google.com with SMTP id hm4so3922370wib.4 for ; Sat, 05 Apr 2014 05:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=jfaFWLO/Pka0xvCrRecyuPDiY8Y+Lvt0Hwklqxm446U=; b=tvIJtmblpLQvZCWaJVNZs4BVsxMqFf9bXbkLEOVH2PqeWJSfoX7Mu5pvGisWRSfHu6 hNaECr92241+rOwun5VL/JPCwxkbAPNuW7dN9yA1hvtSzP7kMvQMloKNyRwgEjFXeyQ7 dgWFxEyWMnbUq1jbbhJ+UJc1vKSpK6UZzMvjjc6v24uSy/KZv37MY9iDDehpswosx72J gWUVlU7pZo1D+Id7O1RA2oMYEruUUc81WdWZHG48PWuIEF2d/AXKubQgCHI2DjXs60Cg 6YO1BV9BG3HQRTnFsa3nDFcpkVu6BVcI6/rmhH9q9oPxzGxHkzJ5kvP5k17rqLEF5tpZ VAiA== X-Received: by 10.194.9.8 with SMTP id v8mr27388451wja.53.1396700529903; Sat, 05 Apr 2014 05:22:09 -0700 (PDT) Received: from kitaj.lan.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id fs4sm10635782wib.11.2014.04.05.05.22.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Apr 2014 05:22:09 -0700 (PDT) From: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Date: Sat, 05 Apr 2014 13:22:06 +0100 Message-ID: <87bnwgq841.fsf@kitaj.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi maintainers, emacs -Q M-x electric-pair-mode RET M-x python-mode RET M-x erase-buffer RET ! Press double quotes (") twice Buffer contents are 7 double quotes instead of 6, with point correctly at 4. This is fixed by the patch attached. Jo=C3=A3o Using changes with id "2". Message: python-triple-quote-fixes M lisp/ChangeLog M lisp/progmodes/python.el M test/ChangeLog M test/automated/python-tests.el =3D=3D=3D modified file 'lisp/ChangeLog' --- a/lisp/ChangeLog 2014-04-05 11:15:07 +0000 +++ b/lisp/ChangeLog 2014-04-05 12:15:08 +0000 @@ -1,3 +1,8 @@ +2014-04-05 Jo=C3=A3o T=C3=A1vora + + * progmodes/python.el (python-electric-pair-string-delimiter): Fix + triple-quoting electricity. + 2014-04-04 Jo=C3=A3o T=C3=A1vora =20 * elec-pair.el: =3D=3D=3D modified file 'lisp/progmodes/python.el' --- a/lisp/progmodes/python.el 2014-04-05 11:15:07 +0000 +++ b/lisp/progmodes/python.el 2014-04-05 12:15:08 +0000 @@ -3651,8 +3651,9 @@ (let ((count 0)) (while (eq (char-before (- (point) count)) last-command-eve= nt) (cl-incf count)) - (=3D count 3))) - (save-excursion (insert (make-string 3 last-command-event))))) + (=3D count 3)) + (eq (char-after) last-command-event)) + (save-excursion (insert (make-string 2 last-command-event))))) =20 (defvar electric-indent-inhibit) =20 =3D=3D=3D modified file 'test/ChangeLog' --- a/test/ChangeLog 2014-04-05 11:15:07 +0000 +++ b/test/ChangeLog 2014-04-05 12:15:08 +0000 @@ -1,3 +1,8 @@ +2014-04-05 Jo=C3=A3o T=C3=A1vora + + * automated/python-tests.el (python-triple-quote-pairing): New test. + (python-syntax-after-python-backspace): New test. + 2014-04-04 Jo=C3=A3o T=C3=A1vora =20 * automated/electric-tests.el (define-electric-pair-test): Don't =3D=3D=3D modified file 'test/automated/python-tests.el' --- a/test/automated/python-tests.el 2014-04-05 11:15:07 +0000 +++ b/test/automated/python-tests.el 2014-04-05 12:15:08 +0000 @@ -134,6 +134,16 @@ ;;; Font-lock and syntax =20 +(ert-deftest python-syntax-after-python-backspace () + ;; `python-indent-dedent-line-backspace' garbles syntax + :expected-result :failed + (python-tests-with-temp-buffer + "\"\"\"" + (goto-char (point-max)) + (python-indent-dedent-line-backspace 1) + (should (string=3D (buffer-string) "\"\"")) + (should (null (nth 3 (syntax-ppss)))))) + ;;; Indentation =20 @@ -2696,6 +2706,9 @@ (equal (symbol-value (car ccons)) (cdr ccons))))) (kill-buffer buffer))) =20 + +;;; Electricity + (ert-deftest python-util-forward-comment-1 () (python-tests-with-temp-buffer (concat @@ -2708,6 +2721,32 @@ (python-util-forward-comment -1) (should (=3D (point) (point-min))))) =20 +(ert-deftest python-triple-quote-pairing () + (python-tests-with-temp-buffer + "\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (string=3D (buffer-string) + "\"\"\"\"\"\"\n")) + (should (=3D (point) 4))) + (python-tests-with-temp-buffer + "\n" + (let ((last-command-event ?\")) + (dotimes (i 3) + (call-interactively 'self-insert-command))) + (should (string=3D (buffer-string) + "\"\"\"\"\"\"\n")) + (should (=3D (point) 4))) + (python-tests-with-temp-buffer + "\"\n\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (=3D (point) (1- (point-max)))) + (should (string=3D (buffer-string) + "\"\n\"\"\"\n")))) + =20 (provide 'python-tests) =20 From unknown Mon Jun 23 23:54:40 2025 X-Loop: help-debbugs@gnu.org Subject: bug#17192: 24.4.50; python-mode's python-electric-pair-string-delimiter inserts an extra quote Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Apr 2014 15:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17192 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Cc: 17192@debbugs.gnu.org Received: via spool by 17192-submit@debbugs.gnu.org id=B17192.139671306825268 (code B ref 17192); Sat, 05 Apr 2014 15:52:02 +0000 Received: (at 17192) by debbugs.gnu.org; 5 Apr 2014 15:51:08 +0000 Received: from localhost ([127.0.0.1]:36991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWSs7-0006ZL-9F for submit@debbugs.gnu.org; Sat, 05 Apr 2014 11:51:07 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:43541) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWSs1-0006Yg-SU for 17192@debbugs.gnu.org; Sat, 05 Apr 2014 11:51:03 -0400 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s35Foxi5003298; Sat, 5 Apr 2014 11:51:00 -0400 Received: by pastel.home (Postfix, from userid 20848) id BD17160125; Sat, 5 Apr 2014 11:50:59 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87bnwgq841.fsf@kitaj.lan> Date: Sat, 05 Apr 2014 11:50:59 -0400 In-Reply-To: <87bnwgq841.fsf@kitaj.lan> ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Sat, 05 Apr 2014 13:22:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4903=0 X-NAI-Spam-Version: 2.3.0.9378 : core <4903> : inlines <692> : streams <1152654> : uri <1721264> X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) > This is fixed by the patch attached. Please install it in emacs-24, thank you, Stefan From unknown Mon Jun 23 23:54:40 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: joaotavora@gmail.com (=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=) Subject: bug#17192: closed (Re: bug#16981: 24.3.50; electric-pair-delete-adjacent-pairs broken in c-mode, python-mode, maybe-others) Message-ID: References: <87zjjyovho.fsf@kitaj.lan> <87bnwgq841.fsf@kitaj.lan> X-Gnu-PR-Message: they-closed 17192 X-Gnu-PR-Package: emacs Reply-To: 17192@debbugs.gnu.org Date: Mon, 07 Apr 2014 00:05:07 +0000 Content-Type: multipart/mixed; boundary="----------=_1396829107-8116-1" This is a multi-part message in MIME format... ------------=_1396829107-8116-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #17192: 24.4.50; python-mode's python-electric-pair-string-delimiter insert= s an extra quote which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 17192@debbugs.gnu.org. --=20 17192: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D17192 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1396829107-8116-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 17192-done) by debbugs.gnu.org; 7 Apr 2014 00:04:55 +0000 Received: from localhost ([127.0.0.1]:38559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWx3W-00025j-A0 for submit@debbugs.gnu.org; Sun, 06 Apr 2014 20:04:54 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:33343) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWx3T-00025L-8i; Sun, 06 Apr 2014 20:04:52 -0400 Received: by mail-wg0-f43.google.com with SMTP id x13so5992738wgg.2 for ; Sun, 06 Apr 2014 17:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Zx2qekBV8sPYx7fM6cK+4QhJ4OingccPvNH4jrM/usQ=; b=pSdJ/vIDGrj6myp99Yc0NPZFdSohgM+oF/hrOfrkDY/r2VyOOjLMU/y9HxntNLpvPx oCxyYUw09+ugwoa9i6cfZYQADW8KmH4EDr9xDocjOn+w/CLacbIkEvGsi/nrO5/Zx4je 1lGMvb7XCfPZ4h3xiilWkKCN463MgGYq8smRtUGjgDO2VnDp6qLnVhl00ZB0Oel+fC01 TcMZxLj2EsuK/QdBnZi+AFhlX9j34z10Oo0oKXt1VZVbfFoL1iFT01Jyk1TEx226KD6u BOFwwF+IHC6kJOHPp89KDIQKdP6l9cJc7OnnnDEM1MKC1zKuYMk0gVduS5t0fPtBpoO1 4pZg== X-Received: by 10.194.201.73 with SMTP id jy9mr38335777wjc.51.1396829087339; Sun, 06 Apr 2014 17:04:47 -0700 (PDT) Received: from kitaj.lan.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id hi1sm23834161wjb.17.2014.04.06.17.04.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 06 Apr 2014 17:04:46 -0700 (PDT) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: Stefan Monnier Subject: Re: bug#16981: 24.3.50; electric-pair-delete-adjacent-pairs broken in c-mode, python-mode, maybe-others References: <87fvlsq977.fsf@kitaj.lan> <877g738buc.fsf@kitaj.lan> Date: Mon, 07 Apr 2014 01:04:35 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 06 Apr 2014 08:48:21 -0400") Message-ID: <87zjjyovho.fsf@kitaj.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17192-done Cc: 16981-done@debbugs.gnu.org, 17192-done@debbugs.gnu.org, 17183-done@debbugs.gnu.org, Alan Mackenzie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: > Just take the corresponding diffs (IIRC you can use > "bzr merge -r116925..r116926 .../trunk" for that) and commit them into > emacs-24. > > Bzr doesn't really know about cherry picking, but if you put > "backported" into your commit message, our bzrmerge.el script > will know that this commit is already in the trunk and will know how to > avoid the corresponding conflicts when merging emacs-24 back into trunk. > >> - Three different fixes (bugs 16981,17192 and 17183) not yet pushed that >> I think you want me to only push to emacs-24, since that will be merged >> back to trunk later. > > Right. These three I did successfully, but failed miserably in the backporting. Oh git where art thou... Now I'm downloading a new repo (with sharing properly setup hopefully), since I must have done something that messed up my bzr conf, apparently I shouldn't have moved my repo dir. Should be done tomorrow morning, so I'll backport r116926 and r116940 then. ------------=_1396829107-8116-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 Apr 2014 12:22:42 +0000 Received: from localhost ([127.0.0.1]:36070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWPcP-0007nk-NB for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33527) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWPcM-0007nV-Vy for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWPcD-0004VJ-Qg for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPcD-0004VE-NP for submit@debbugs.gnu.org; Sat, 05 Apr 2014 08:22:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPc4-0003dj-H9 for bug-gnu-emacs@gnu.org; Sat, 05 Apr 2014 08:22:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWPbv-0004Bo-AX for bug-gnu-emacs@gnu.org; Sat, 05 Apr 2014 08:22:20 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:49751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPbu-00049P-VL for bug-gnu-emacs@gnu.org; Sat, 05 Apr 2014 08:22:11 -0400 Received: by mail-wi0-f169.google.com with SMTP id hm4so3922370wib.4 for ; Sat, 05 Apr 2014 05:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=jfaFWLO/Pka0xvCrRecyuPDiY8Y+Lvt0Hwklqxm446U=; b=tvIJtmblpLQvZCWaJVNZs4BVsxMqFf9bXbkLEOVH2PqeWJSfoX7Mu5pvGisWRSfHu6 hNaECr92241+rOwun5VL/JPCwxkbAPNuW7dN9yA1hvtSzP7kMvQMloKNyRwgEjFXeyQ7 dgWFxEyWMnbUq1jbbhJ+UJc1vKSpK6UZzMvjjc6v24uSy/KZv37MY9iDDehpswosx72J gWUVlU7pZo1D+Id7O1RA2oMYEruUUc81WdWZHG48PWuIEF2d/AXKubQgCHI2DjXs60Cg 6YO1BV9BG3HQRTnFsa3nDFcpkVu6BVcI6/rmhH9q9oPxzGxHkzJ5kvP5k17rqLEF5tpZ VAiA== X-Received: by 10.194.9.8 with SMTP id v8mr27388451wja.53.1396700529903; Sat, 05 Apr 2014 05:22:09 -0700 (PDT) Received: from kitaj.lan.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id fs4sm10635782wib.11.2014.04.05.05.22.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Apr 2014 05:22:09 -0700 (PDT) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: bug-gnu-emacs@gnu.org Subject: 24.4.50; python-mode's python-electric-pair-string-delimiter inserts an extra quote Date: Sat, 05 Apr 2014 13:22:06 +0100 Message-ID: <87bnwgq841.fsf@kitaj.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Hi maintainers, emacs -Q M-x electric-pair-mode RET M-x python-mode RET M-x erase-buffer RET ! Press double quotes (") twice Buffer contents are 7 double quotes instead of 6, with point correctly at 4. This is fixed by the patch attached. Jo=C3=A3o Using changes with id "2". Message: python-triple-quote-fixes M lisp/ChangeLog M lisp/progmodes/python.el M test/ChangeLog M test/automated/python-tests.el =3D=3D=3D modified file 'lisp/ChangeLog' --- a/lisp/ChangeLog 2014-04-05 11:15:07 +0000 +++ b/lisp/ChangeLog 2014-04-05 12:15:08 +0000 @@ -1,3 +1,8 @@ +2014-04-05 Jo=C3=A3o T=C3=A1vora + + * progmodes/python.el (python-electric-pair-string-delimiter): Fix + triple-quoting electricity. + 2014-04-04 Jo=C3=A3o T=C3=A1vora =20 * elec-pair.el: =3D=3D=3D modified file 'lisp/progmodes/python.el' --- a/lisp/progmodes/python.el 2014-04-05 11:15:07 +0000 +++ b/lisp/progmodes/python.el 2014-04-05 12:15:08 +0000 @@ -3651,8 +3651,9 @@ (let ((count 0)) (while (eq (char-before (- (point) count)) last-command-eve= nt) (cl-incf count)) - (=3D count 3))) - (save-excursion (insert (make-string 3 last-command-event))))) + (=3D count 3)) + (eq (char-after) last-command-event)) + (save-excursion (insert (make-string 2 last-command-event))))) =20 (defvar electric-indent-inhibit) =20 =3D=3D=3D modified file 'test/ChangeLog' --- a/test/ChangeLog 2014-04-05 11:15:07 +0000 +++ b/test/ChangeLog 2014-04-05 12:15:08 +0000 @@ -1,3 +1,8 @@ +2014-04-05 Jo=C3=A3o T=C3=A1vora + + * automated/python-tests.el (python-triple-quote-pairing): New test. + (python-syntax-after-python-backspace): New test. + 2014-04-04 Jo=C3=A3o T=C3=A1vora =20 * automated/electric-tests.el (define-electric-pair-test): Don't =3D=3D=3D modified file 'test/automated/python-tests.el' --- a/test/automated/python-tests.el 2014-04-05 11:15:07 +0000 +++ b/test/automated/python-tests.el 2014-04-05 12:15:08 +0000 @@ -134,6 +134,16 @@ ;;; Font-lock and syntax =20 +(ert-deftest python-syntax-after-python-backspace () + ;; `python-indent-dedent-line-backspace' garbles syntax + :expected-result :failed + (python-tests-with-temp-buffer + "\"\"\"" + (goto-char (point-max)) + (python-indent-dedent-line-backspace 1) + (should (string=3D (buffer-string) "\"\"")) + (should (null (nth 3 (syntax-ppss)))))) + ;;; Indentation =20 @@ -2696,6 +2706,9 @@ (equal (symbol-value (car ccons)) (cdr ccons))))) (kill-buffer buffer))) =20 + +;;; Electricity + (ert-deftest python-util-forward-comment-1 () (python-tests-with-temp-buffer (concat @@ -2708,6 +2721,32 @@ (python-util-forward-comment -1) (should (=3D (point) (point-min))))) =20 +(ert-deftest python-triple-quote-pairing () + (python-tests-with-temp-buffer + "\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (string=3D (buffer-string) + "\"\"\"\"\"\"\n")) + (should (=3D (point) 4))) + (python-tests-with-temp-buffer + "\n" + (let ((last-command-event ?\")) + (dotimes (i 3) + (call-interactively 'self-insert-command))) + (should (string=3D (buffer-string) + "\"\"\"\"\"\"\n")) + (should (=3D (point) 4))) + (python-tests-with-temp-buffer + "\"\n\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (=3D (point) (1- (point-max)))) + (should (string=3D (buffer-string) + "\"\n\"\"\"\n")))) + =20 (provide 'python-tests) =20 ------------=_1396829107-8116-1--