Subject: bug#4136: 23.1; delete-pair

From: Eli Barzilay <[email-masked]>
Date: Fri, 14 Aug 2009 21:46:29 -0400

On Aug 15, Juri Linkov wrote:
> > Here is a version that checks that does exactly what Martin
> > suggested.  It even fails on something like (...] -- which is very
> > useful for keyboard macros, since if you have that text in a
> > buffer, then something is probably messed up enough to require
> > your attention.
> 
> This command is useful even if it doesn't fail on (...] because
> forward-sexp and backward-sexp don't fail on (...].

Martin's example of '(blah) works better, but in general...

> 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.

> In this case I think we sould have two commands: one more strict
> version `delete-pair' that checks `insert-pair-alist', and another
> loose version with the name e.g.  `delete-parens' with the body of
> the current `delete-pair'.

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?

On Aug 15, Juri Linkov wrote:
> >> This is rather vague semantics.  I suggest to keep the current
> >> simple semantics and just to fix it with the patch I sent.
> >
> > Before a quoted object your fixed version deletes the last
> > character of the object and the first quote character.  Handling
> > quote or prefix syntax characters via (delete-char 1) doesn't
> > strike me as very clean.
> 
> 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)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!