From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32896: 27.0.50; wishlist: Delete matching pairs Date: Wed, 17 Oct 2018 02:00:14 +0300 Organization: LINKOV.NET Message-ID: <87murdlcox.fsf@mail.linkov.net> References: <87r2h9wxa4.fsf@gmail.com> <87a7not799.fsf@mail.linkov.net> <87ftxgf25b.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1539730809 11292 195.159.176.226 (16 Oct 2018 23:00:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 16 Oct 2018 23:00:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 32896@debbugs.gnu.org To: Alex Branham Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 17 01:00:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gCYJo-0002oa-3J for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Oct 2018 01:00:04 +0200 Original-Received: from localhost ([::1]:60527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCYLu-0006Cn-Es for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Oct 2018 19:02:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCYLl-0006CT-Pm for bug-gnu-emacs@gnu.org; Tue, 16 Oct 2018 19:02:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCYLi-0002Xl-Iq for bug-gnu-emacs@gnu.org; Tue, 16 Oct 2018 19:02:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49840) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCYLi-0002Xd-8D for bug-gnu-emacs@gnu.org; Tue, 16 Oct 2018 19:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gCYLi-00075M-27 for bug-gnu-emacs@gnu.org; Tue, 16 Oct 2018 19:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Oct 2018 23:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32896 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32896-submit@debbugs.gnu.org id=B32896.153973090327200 (code B ref 32896); Tue, 16 Oct 2018 23:02:01 +0000 Original-Received: (at 32896) by debbugs.gnu.org; 16 Oct 2018 23:01:43 +0000 Original-Received: from localhost ([127.0.0.1]:54098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gCYLP-00074e-8H for submit@debbugs.gnu.org; Tue, 16 Oct 2018 19:01:43 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:45228 helo=pdx1-sub0-mail-a7.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gCYLO-00074W-Ae for 32896@debbugs.gnu.org; Tue, 16 Oct 2018 19:01:42 -0400 Original-Received: from pdx1-sub0-mail-a7.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a7.g.dreamhost.com (Postfix) with ESMTP id 9E9837F668; Tue, 16 Oct 2018 16:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=vADhGHUTvYBuzeDkNR9pxlgGF10=; b= N6wjuyuxDRp2TznUBHOoQEsjdXw+jWax3sWYxK1kHejmB/r64UkwXofe+tQOsLkX 2FzJS2tH32WaSXEj1RiQCJUIbehERMhowcp94/rnFC6UlZMrRtttNOHkHaKFhaEP V09rcVei65vj+fwwv+/u6DGZVwAx1LmjmDa+MDjcyuo= Original-Received: from localhost.linkov.net (m91-129-96-249.cust.tele2.ee [91.129.96.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a7.g.dreamhost.com (Postfix) with ESMTPSA id 8986F7F688; Tue, 16 Oct 2018 16:01:40 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a7 In-Reply-To: <87ftxgf25b.fsf@gmail.com> (Alex Branham's message of "Mon, 08 Oct 2018 18:29:36 -0500") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrfedugdduiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehmtderredtreejnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrleeirddvgeelnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehlohgtrghlhhhoshhtrdhlihhnkhhovhdrnhgvthdpihhnvghtpeeluddruddvledrleeirddvgeelpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtoheprghlvgigrdgsrhgrnhhhrghmsehgmhgrihhlrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151329 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >> Fortunately, Emacs already has such a command named =E2=80=98delete-pa= ir=E2=80=99: >> it deletes the parens around the let function as in your first >> example as well as the quotes in your second example. It makes >> sense to bind this command to e.g. =E2=80=98C-x M-(=E2=80=99 to be the= inverse of >> =E2=80=98M-(=E2=80=99 (insert-pair) > > Yay! I didn't know about that command (and I really did search before > reporting this bug, no idea how I missed it!). It doesn't work backward > though as far as I can tell: > > (let (message "%s" "foobar")|) With a simple twist in the patch attached, it will be able to work backwa= rd with M-- M-x delete-pair, i.e. with a negative prefix argument. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=delete-pair.patch diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 5a89923f8f..fd6018988e 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -723,11 +723,12 @@ insert-parentheses (interactive "P") (insert-pair arg ?\( ?\))) -(defun delete-pair () +(defun delete-pair (&optional arg) "Delete a pair of characters enclosing the sexp that follows point." - (interactive) - (save-excursion (forward-sexp 1) (delete-char -1)) - (delete-char 1)) + (interactive "p") + (unless arg (setq arg 1)) + (save-excursion (forward-sexp arg) (delete-char (if (> arg 0) -1 1))) + (delete-char (if (> arg 0) 1 -1))) (defun raise-sexp (&optional arg) "Raise ARG sexps higher up the tree." --=-=-=--