GNU bug report logs - #39680
27.0.60; electric-pair-mode broken by undo

Previous Next

Package: emacs;

Reported by: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>

Date: Wed, 19 Feb 2020 18:35:01 UTC

Severity: normal

Found in version 27.0.60

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: Alan Mackenzie <acm <at> muc.de>, control <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 39680 <at> debbugs.gnu.org
Subject: Re: bug#39680: 27.0.60; electric-pair-mode broken by undo
Date: Wed, 13 May 2020 12:08:30 +0200
unarchive 39680
thanks

João Távora <joaotavora <at> gmail.com> writes:

> If you see this consistently failing when you revert the earlier fix and
> passing now, I'd just add it to test/lisp/electric-tests.el.

Thank you for prompting me to check; infuriatingly, this test does *not*
fail when reverting Stefan's fix, although the manual recipe (39680#5)
fails consistently.  Obviously I'm missing something and the test needs
more work.

>                                                               A short
> docstring summarily explaining what is being tested is useful.  Or maybe
> not, I think can read it without it.

FWIW I've added a docstring and moved the test to electric-tests.el,
right after the "backspacing" tests.


diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 6334c62a31..d259f31a4c 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -545,6 +545,22 @@ js-mode-braces-with-layout-and-indent
       (goto-char 2)
       (electric-pair-delete-pair 1)
       (should (equal "" (buffer-string))))))
+
+;;; Undoing
+(ert-deftest electric-pair-undo-unrelated-state ()
+  "Make sure `undo' does not get confused by `electric-pair-mode' (bug#39680)."
+  (with-temp-buffer
+    (buffer-enable-undo)
+    (electric-pair-local-mode)
+    (let ((last-command-event ?\())
+      (self-insert-command 1))
+    (undo-boundary)
+    (insert "a")
+    (undo-boundary)
+    (call-interactively #'undo)
+    (let ((last-command-event ?\())
+      (self-insert-command 1))
+    (should (string= (buffer-string) "(())"))))
 
 
 ;;; Electric newlines between pairs




This bug report was last modified 5 years and 2 days ago.

Previous Next


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