all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Mohammed Sadik <sadiq@sadiqpk.org>
Cc: 23298@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	[thread overview]
Message-ID: <87ftmpapnu.fsf@mouse.gnus.org> (raw)
In-Reply-To: <CANHUxH02=sMnHjC1G-TDRwXyHRvbcvubdViAY336aXkA4q4DjQ@mail.gmail.com> (Mohammed Sadik's message of "Sat, 16 Apr 2016 07:08:50 +0530")

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?

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





  reply	other threads:[~2019-07-28 20:07 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 [this message]
2020-08-12  2:52   ` Stefan Kangas
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=87ftmpapnu.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=23298@debbugs.gnu.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.