GNU bug report logs - #72437
Unexpected behavior when inserting with prefix arg in electric-pair-mode

Previous Next

Package: emacs;

Reported by: Joseph Turner <joseph <at> breatheoutbreathe.in>

Date: Sat, 3 Aug 2024 07:14:02 UTC

Severity: normal

Fixed in version 31.1

Done: Eshel Yaron <me <at> eshelyaron.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Joseph Turner <joseph <at> breatheoutbreathe.in>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: 72437 <at> debbugs.gnu.org, eliz <at> gnu.org, monnier <at> iro.umontreal.ca
Subject: bug#72437: Unexpected behavior when inserting with prefix arg in electric-pair-mode
Date: Sat, 21 Sep 2024 10:24:57 -0700
[Message part 1 (text/plain, inline)]
Eshel Yaron <me <at> eshelyaron.com> writes:

> Joseph Turner <joseph <at> breatheoutbreathe.in> writes:
>
>> Joseph Turner <joseph <at> breatheoutbreathe.in> writes:
>>
>>> On August 13, 2024 10:07:23 PM PDT, Eshel Yaron <me <at> eshelyaron.com> wrote:
>>>>Hi Stefan,
>>>>
>>>>Stefan Monnier writes:
>>>>
>>>>>> Let's hear what Stefan thinks (and anyone else who has an
>>>>>> opinion or some case other than electric-pair-mode).
>>>>>
>>>>> I think the requested behavior makes a lot of sense, but I lost touch
>>>>> with the way elec-pair works and interacts with other electric modes, so
>>>>> I'm not sure how to make it work without breaking other things.
>>>>
>>>>In case you missed it, the patch I shared upthread might give you
>>>>some ideas.  It implements the requested behavior, safely, I think.
>>>>So I would just ask Joseph to try it out for a while and see if it
>>>>works as expected and if any other issues crop up :)
>>>
>>> Thanks for this patch!  I am testing it in my daily config.  So far
>>> so good, and I'll report back after a few weeks of usage.
>>
>> I have been running this patch for over a month with no issue.
>
> That's great, thanks for testing it and for reporting back!
>
>> I vote to merge it!
>
> Agreed.  Here's a full patch with tests, doc updates and a NEWS entry:

Nice!  How about also adding a test like the attached patch?

[0001-Test-behavior-with-prefix-argument.patch (text/x-diff, inline)]
From 414a4b1fa09b0b976e74144430871b1b5a9ddbbe Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph <at> breatheoutbreathe.in>
Date: Sat, 21 Sep 2024 10:23:07 -0700
Subject: [PATCH] Test behavior with prefix argument

* test/lisp/electric-tests.el (electric-pair-backspace-2)
---
 test/lisp/electric-tests.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 720313511a6..f1742fe3f0b 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -562,6 +562,14 @@ electric-pair-backspace-1
       (electric-pair-delete-pair 1)
       (should (equal "" (buffer-string))))))
 
+(ert-deftest electric-pair-backspace-2 ()
+  (save-electric-modes
+   (with-temp-buffer
+     (insert "((()))")
+     (goto-char 4)
+     (electric-pair-delete-pair 2)
+     (should (equal "()" (buffer-string))))))
+
 
 ;;; Undoing
 (ert-deftest electric-pair-undo-unrelated-state ()
-- 
2.46.0


This bug report was last modified 302 days ago.

Previous Next


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