GNU bug report logs - #23298
25.0.92; electric-pair-delete-pair doesn't check if parens are balanced

Previous Next

Package: emacs;

Reported by: Mohammed Sadik <sadiq <at> sadiqpk.org>

Date: Sat, 16 Apr 2016 01:40:02 UTC

Severity: normal

Found in version 25.0.92

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Mohammed Sadik <sadiq <at> sadiqpk.org>, 23298 <at> debbugs.gnu.org
Subject: bug#23298: 25.0.92; electric-pair-delete-pair doesn't check if parens are balanced
Date: Tue, 11 Aug 2020 19:52:12 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Mohammed Sadik <sadiq <at> sadiqpk.org> writes:
>
>> When pressing Backspace key, with electric-pair-mode enabled,
>> it unconditionally deletes the following char, if its the matching pair.
>> Ideally, it may better check if it breaks the equilibrium of
>> braces/quotes.
>>
>> Eg: code: (char-before (point))
>>                              |_ point location
>> If my point (cursor) is just before the last paren (the cursor is
>> blinking on the last paren), and I press backspace until the beginning
>> of "point"[0], and then one char back[1], it just deletes the bracket,
>> without checking if the parens are balanced.
>>
>> code:
>>         [0] (char-before ()
>>                          |_point location
>>         [1] (char-before
>>                         |_ point location
>>
>> This could be the case of quotes, braces, etc.
>
> (I'm going through old Emacs bug reports that haven't received any
> response.)
>
> Or a simpler example:
>
> (foo ()
>
> If you put point after the next-to-last character, then hitting DEL will
> delete the last pair:
>
> (foo
>
> But...  I don't think this is a bug?  electric-pair-mode doesn't promise
> to keep things balanced globally, but delete the matching pair if you
> delete an opening parenthesis?  I think.
>
> Does that tally with what everybody else would expect?

Do we have any electric-pair-mode users who could comment on this?

Best regards,
Stefan Kangas




This bug report was last modified 4 years and 304 days ago.

Previous Next


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