all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Mohammed Sadik <sadiq@sadiqpk.org>, 23298@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	[thread overview]
Message-ID: <CADwFkmkQgScySz3a_G8yBPSCMtYORQ9WUtBNR6Kjpqei1XkhLg@mail.gmail.com> (raw)
In-Reply-To: <87ftmpapnu.fsf@mouse.gnus.org> (Lars Ingebrigtsen's message of "Sun, 28 Jul 2019 22:07:49 +0200")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mohammed Sadik <sadiq@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





  reply	other threads:[~2020-08-12  2:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-16  1:38 bug#23298: 25.0.92; electric-pair-delete-pair doesn't check if parens are balanced Mohammed Sadik
2019-07-28 20:07 ` Lars Ingebrigtsen
2020-08-12  2:52   ` Stefan Kangas [this message]
2020-08-14  9:37     ` Andrii Kolomoiets

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADwFkmkQgScySz3a_G8yBPSCMtYORQ9WUtBNR6Kjpqei1XkhLg@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=23298@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=sadiq@sadiqpk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.