all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Eli Barzilay <eli@barzilay.org>
Cc: 4136@emacsbugs.donarmstrong.com
Subject: bug#4136: 23.1; delete-pair
Date: Mon, 17 Aug 2009 03:46:46 +0300	[thread overview]
Message-ID: <87k5131d3d.fsf@mail.jurta.org> (raw)
In-Reply-To: <19079.19478.357436.68768@winooski.ccs.neu.edu> (Eli Barzilay's message of "Sat, 15 Aug 2009 20:00:22 -0400")

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

You can write smileys using the closing parenthesis (but we should
improve `delete-pair' to delete smileys completely after deleting the
closing parenthesis ;-)

> Still, the first time I tried this, the cursor was at the beginning of
> an indented line.

Where did you get this weird idea that `delete-pair' should delete
a character far away from the current cursor position?  Look,
`insert-char' inserts a character at point and `delete-char' deletes
a character at point.  `insert-pair' inserts an opening character
at point.  So why `delete-pair' shouldn't do the same?  Why it shouldn't
delete an opening character at point instead of using some additional
heuristics to find the position of the opening character?

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

Why would I want to put cursor on a non-paren when I want to delete a paren?

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

99% of time when you write a program it is in the erroneous state until
you finish editing.  But this doesn't mean we should disallow the user
to have an intermediate erroneous state.  So of course, in the above
example you can add necessary quotes after deleting a pair of parentheses.

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

Emacs is good at following the KISS principle to not over-engineer
simple functions.

-- 
Juri Linkov
http://www.jurta.org/emacs/





  reply	other threads:[~2009-08-17  0:46 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-13  6:22 bug#4136: 23.1; delete-pair Eli Barzilay
2009-08-13  9:53 ` martin rudalics
2009-08-13 23:29   ` Juri Linkov
2009-08-14  1:18     ` Eli Barzilay
2009-08-14 15:50       ` Stefan Monnier
2009-08-14 22:45       ` Juri Linkov
2009-08-15  1:46         ` Eli Barzilay
2009-08-15 23:06           ` Juri Linkov
2009-08-16  0:00             ` Eli Barzilay
2009-08-17  0:46               ` Juri Linkov [this message]
2009-08-17  3:13                 ` Eli Barzilay
2009-08-17 21:17                   ` Juri Linkov
2009-08-18  7:13                     ` martin rudalics
2009-08-19  0:48                       ` Juri Linkov
2020-09-14 14:08                       ` Lars Ingebrigtsen
2020-09-14 19:12                         ` Juri Linkov
2020-09-15 12:27                           ` Lars Ingebrigtsen
2020-09-15 18:07                             ` Juri Linkov
2020-09-17 14:45                               ` Lars Ingebrigtsen
2020-09-18  8:35                                 ` Juri Linkov
2020-09-18 10:59                                   ` Lars Ingebrigtsen
2020-09-21 19:12                                     ` Juri Linkov
2020-09-22 14:45                                       ` Lars Ingebrigtsen
2020-09-22 18:18                                         ` Juri Linkov
2020-09-23 13:15                                           ` Lars Ingebrigtsen
2020-11-12 20:21                                             ` Juri Linkov
2020-11-12 21:16                                               ` Basil L. Contovounesios
2020-11-13  8:29                                                 ` Juri Linkov
2020-11-16 20:55                                                   ` Juri Linkov
2020-11-16 21:37                                                     ` Drew Adams
2009-08-16 10:27             ` martin rudalics
2009-08-18  3:10           ` Stefan Monnier
2009-08-19  0:47             ` Juri Linkov
2009-08-15 10:11         ` martin rudalics
2009-08-14  7:17     ` martin rudalics
2009-08-14 22:45       ` Juri Linkov
2009-08-15 10:11         ` martin rudalics
2009-08-15 23:03           ` Juri Linkov
2009-08-16 10:27             ` martin rudalics
2009-08-13 23:28 ` Juri Linkov

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=87k5131d3d.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=4136@emacsbugs.donarmstrong.com \
    --cc=eli@barzilay.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.