From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Barzilay Newsgroups: gmane.emacs.bugs Subject: bug#4136: 23.1; delete-pair Date: Sat, 15 Aug 2009 20:00:22 -0400 Message-ID: <19079.19478.357436.68768@winooski.ccs.neu.edu> References: <19075.45378.67131.491453@winooski.ccs.neu.edu> <4A83E299.3060002@gmx.at> <87tz0bqqhm.fsf@mail.jurta.org> <4A850F6C.2080205@gmx.at> <873a7uc8mg.fsf@mail.jurta.org> <4A8689EE.9020402@gmx.at> <87ljlk4snf.fsf@mail.jurta.org> <87eirfs56q.fsf@mail.jurta.org> <19076.47996.128071.281272@winooski.ccs.neu.edu> <87pray9ezq.fsf@mail.jurta.org> <19078.4981.525959.210519@winooski.ccs.neu.edu> <87ab20znhd.fsf@mail.jurta.org> Reply-To: Eli Barzilay , 4136@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1250381244 28359 80.91.229.12 (16 Aug 2009 00:07:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Aug 2009 00:07:24 +0000 (UTC) Cc: 4136@emacsbugs.donarmstrong.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 16 02:07:17 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1McTHI-0006zs-6S for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Aug 2009 02:07:16 +0200 Original-Received: from localhost ([127.0.0.1]:34879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McTHH-00039C-NW for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Aug 2009 20:07:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1McTH2-00034G-JU for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:07:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1McTGw-00032U-Vl for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:06:59 -0400 Original-Received: from [199.232.76.173] (port=57756 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1McTGw-000328-Bm for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:06:54 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:59472) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1McTGv-00083f-4h for bug-gnu-emacs@gnu.org; Sat, 15 Aug 2009 20:06:53 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7G06nB2014211; Sat, 15 Aug 2009 17:06:50 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n7G05Ccr014033; Sat, 15 Aug 2009 17:05:12 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Eli Barzilay Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 16 Aug 2009 00:05:12 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4136 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4136-submit@emacsbugs.donarmstrong.com id=B4136.125038082512608 (code B ref 4136); Sun, 16 Aug 2009 00:05:12 +0000 Original-Received: (at 4136) by emacsbugs.donarmstrong.com; 16 Aug 2009 00:00:25 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from barzilay.org (winooski.ccs.neu.edu [129.10.115.117]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7G00OQt012603 for <4136@emacsbugs.donarmstrong.com>; Sat, 15 Aug 2009 17:00:25 -0700 Original-Received: from eli by barzilay.org with local (Exim 4.66) (envelope-from ) id 1McTAc-0006v2-Bv; Sat, 15 Aug 2009 20:00:22 -0400 In-Reply-To: <87ab20znhd.fsf@mail.jurta.org> X-Mailer: VM 7.19 under Emacs 22.1.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Sat, 15 Aug 2009 20:06:59 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30245 Archived-At: On Aug 16, Juri Linkov wrote: > >> It seems you and Martin prefer checking against the > >> `insert-pair-alist' because the function name `delete-pair' > >> suggests it should be a counterpart of `insert-pair'. > > > > ...this is exactly the issue: it is much better if `delete-foo' is > > always an operation that reverts what `insert-foo' does. > > The exact reverse is impossible. Of course it isn't, but the operation is one that negates in what it "generally does" the thing that `insert-foo' does. Just like `scroll-down' and `scroll-up' are opposites even though they don't always cancel out. > > The current state of `delete-pair' is so bad that my guess is that > > hardly anyone used it, so adding another command doesn't make much > > sense. How about making it do the proper thing (removing only > > balanced pairs as specified by `insert-pair-alist'), and ignoring > > errors with a prefix argument? > > I've been using `delete-pair' for many years several times a day > without any problem because my lists are always correctly balanced > thanks to `insert-pair' that I exclusively use to create balanced > lists and strings. Believe me, I've written a paren or two, and I use `insert-pair' enough to have my own improved version of it. (In fact, guess why I almost never use smileys in emails.) Still, the first time I tried this, the cursor was at the beginning of an indented line. But the point is still the same: having two nearly identical functions is exactly what prefix arguments are for. > That's why even in the current state of `delete-pair' it is the > useful reverse of `insert-pair' because the latter creates balanced > lists and the former deletes them. ... unless you happen to have your cursor on a non-paren. > >> This is fixed in the following version: > >> [...] > > > > This version doesn't make much sense as an operation you'd want to do > > on code: > > > > (foo '(x y z)) > > --> > > (foo 'x y z) > > It makes sense when `foo' is a multi-argument function like `list', > e.g. > > (list 'x y z) > > So I see no reason to introduce more restrictions to decide what > parens the user is allowed to delete in his/her code. You've missed my point: the difference between "y" and "'y" is *huge*, changing one to the other is something that you don't want to do by mistake. On Aug 16, Juri Linkov wrote: > >> This is fixed in the following version: > >> > >> (defun delete-pair () > >> "Delete a pair of characters enclosing the sexp that follows point." > >> (interactive) > >> (save-excursion > >> (forward-sexp 1) > >> (save-excursion > >> (backward-sexp 1) > >> (skip-syntax-forward "'") > >> (delete-char 1)) > >> (delete-char -1))) > > > > Still doesn't seem TDTRT with `point' before something like > > > > `foo' > > I know, I know, after I fix this, you'll come up with another > test case like > > `foo bar' Those examples are very good IMO -- it's not being picky for nothing, it's an attempt to avoid nasty surprises that make you end up with erroneous code. Emacs is usually good at being a careful editor for code, `delete-pair' is very exceptional in this aspect. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life!