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: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Mohammed Sadik <sadiq <at> sadiqpk.org>
Cc: 23298 <at> debbugs.gnu.org
Subject: bug#23298: 25.0.92; electric-pair-delete-pair doesn't check if parens are balanced
Date: Sun, 28 Jul 2019 22:07:49 +0200
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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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.