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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Mohammed Sadik <sadiq@HIDDEN>; dated Sat, 16 Apr 2016 01:40:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 23298 <at> debbugs.gnu.org:


Received: (at 23298) by debbugs.gnu.org; 28 Jul 2019 20:07:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 28 16:07:54 2019
Received: from localhost ([127.0.0.1]:47217 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hrpSU-0000F8-Cw
	for submit <at> debbugs.gnu.org; Sun, 28 Jul 2019 16:07:54 -0400
Received: from quimby.gnus.org ([80.91.231.51]:32884)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1hrpST-0000F0-93
 for 23298 <at> debbugs.gnu.org; Sun, 28 Jul 2019 16:07:53 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1hrpSQ-0007IV-5f; Sun, 28 Jul 2019 22:07:52 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Mohammed Sadik <sadiq@HIDDEN>
Subject: Re: bug#23298: 25.0.92; electric-pair-delete-pair doesn't check if
 parens are balanced
References: <CANHUxH02=sMnHjC1G-TDRwXyHRvbcvubdViAY336aXkA4q4DjQ@HIDDEN>
Date: Sun, 28 Jul 2019 22:07:49 +0200
In-Reply-To: <CANHUxH02=sMnHjC1G-TDRwXyHRvbcvubdViAY336aXkA4q4DjQ@HIDDEN>
 (Mohammed Sadik's message of "Sat, 16 Apr 2016 07:08:50 +0530")
Message-ID: <87ftmpapnu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Mohammed Sadik <sadiq@HIDDEN> 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 o [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 23298
Cc: 23298 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#23298; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 Apr 2016 01:39:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 15 21:39:07 2016
Received: from localhost ([127.0.0.1]:36976 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1arFCV-0002FH-6x
	for submit <at> debbugs.gnu.org; Fri, 15 Apr 2016 21:39:07 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54134)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sadiq@HIDDEN>) id 1arFCT-0002Eo-G4
 for submit <at> debbugs.gnu.org; Fri, 15 Apr 2016 21:39:05 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <sadiq@HIDDEN>) id 1arFCN-0002A3-Ey
 for submit <at> debbugs.gnu.org; Fri, 15 Apr 2016 21:39:00 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:40605)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <sadiq@HIDDEN>) id 1arFCN-00029z-BU
 for submit <at> debbugs.gnu.org; Fri, 15 Apr 2016 21:38:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45101)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <sadiq@HIDDEN>) id 1arFCM-0006rF-60
 for bug-gnu-emacs@HIDDEN; Fri, 15 Apr 2016 21:38:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <sadiq@HIDDEN>) id 1arFCH-00029U-7A
 for bug-gnu-emacs@HIDDEN; Fri, 15 Apr 2016 21:38:58 -0400
Received: from md-77.webhostbox.net ([199.79.62.63]:42574)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <sadiq@HIDDEN>) id 1arFCH-00029P-2P
 for bug-gnu-emacs@HIDDEN; Fri, 15 Apr 2016 21:38:53 -0400
Received: from mail-wm0-f48.google.com ([74.125.82.48]:36970)
 by md-77.webhostbox.net with esmtpsa (TLSv1:AES128-SHA:128)
 (Exim 4.86_1) (envelope-from <sadiq@HIDDEN>) id 1arFCF-000t2k-4Q
 for bug-gnu-emacs@HIDDEN; Sat, 16 Apr 2016 01:38:51 +0000
Received: by mail-wm0-f48.google.com with SMTP id n3so53950133wmn.0
 for <bug-gnu-emacs@HIDDEN>; Fri, 15 Apr 2016 18:38:51 -0700 (PDT)
X-Gm-Message-State: AOPr4FVeXjSxXmUaFQyBurAuLifEn0c9AkFi2nj0rD8+NFyzH5sH/YHkJ/PCpUCF+7II+X1GxPoeyESJg/OPaQ==
MIME-Version: 1.0
X-Received: by 10.194.6.36 with SMTP id x4mr24474433wjx.122.1460770730384;
 Fri, 15 Apr 2016 18:38:50 -0700 (PDT)
Received: by 10.194.74.227 with HTTP; Fri, 15 Apr 2016 18:38:50 -0700 (PDT)
Date: Sat, 16 Apr 2016 07:08:50 +0530
X-Gmail-Original-Message-ID: <CANHUxH02=sMnHjC1G-TDRwXyHRvbcvubdViAY336aXkA4q4DjQ@HIDDEN>
Message-ID: <CANHUxH02=sMnHjC1G-TDRwXyHRvbcvubdViAY336aXkA4q4DjQ@HIDDEN>
Subject: 25.0.92;
 electric-pair-delete-pair doesn't check if parens are balanced
From: Mohammed Sadik <sadiq@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-Authenticated_sender: sadiq@HIDDEN
X-OutGoing-Spam-Status: No, score=-1.0
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - md-77.webhostbox.net
X-AntiAbuse: Original Domain - gnu.org
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - sadiqpk.org
X-Get-Message-Sender-Via: md-77.webhostbox.net: authenticated_id:
 sadiq@HIDDEN
X-Authenticated-Sender: md-77.webhostbox.net: sadiq@HIDDEN
X-Source: 
X-Source-Args: 
X-Source-Dir: 
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

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.

In GNU Emacs 25.0.92.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-13 built on fedora.localdomain
Windowing system distributor 'Fedora Project', version 11.0.11800000
Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: en_IN.UTF-8
  value of $LC_NUMERIC: en_IN.UTF-8
  value of $LC_TIME: en_IN.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Electric-Pair mode enabled
41 (#o51, #x29, ?\))
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec epg epg-config gnus-util mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util help-fns help-mode easymenu cl-loaddefs pcase
cl-lib mail-prsvr mail-utils cus-start cus-load elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 93411 4512)
 (symbols 48 20513 0)
 (miscs 40 79 146)
 (strings 32 15817 4612)
 (string-bytes 1 434978)
 (vectors 16 11738)
 (vector-slots 8 421568 5007)
 (floats 8 166 249)
 (intervals 56 218 10)
 (buffers 976 12)
 (heap 1024 46579 1042))




Acknowledgement sent to Mohammed Sadik <sadiq@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#23298; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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