[racket-dev] Survey for DrRacket users related to automatic parentheses behavior

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Thu Nov 22 19:20:54 EST 2012

Hello all,

I've been discussing with Robby a possible improvement of DrRacket's
"automatic parentheses" behavior and would like to get a sense of others'
general opinion about this. What follows is a description of my proposal
and then some concrete questions.

The idea is to have DrRacket automatically skip over automatically-inserted
closing parens if the user types one while the cursor is right in front of
one. (The Eclipse Java IDE does this with various types of braces and
parens, and in the past I've found this very nice and have observed others
(my students) interact well with such a feature.)

A concrete example: suppose you are in the process of typing the expression
"(+ 4 (- 1 2) 3)". After you type the first opening parentheses and the
characters following it up to the "2", the expression in the editor looks
  (+ 4 (- 1 2|))
where the | represents the cursor's position. Note the two
automatically-inserted closing parens that are after the cursor right now. With
the current implementation, you have to then use the right arrow key to
make the cursor skip past the first auto-inserted ")" and then you can type
"3". However, that really disrupts the typing process because even if you
don't type a ) as a habit and then realize you have to delete the extra
one, you still have to lift and move your finger to the arrow keys area of
the keyboard or type some other key combination to skip the cursor forward.

My proposal would be to have it so that if you type ")" in the editor state
above, it becomes:
  (+ 4 (- 1 2)|)
and now you continue typing a space and the 3. Of course, the same thing
should apply for other types of parens - ( [ { etc.

I don't know about others, but I actually get annoyed with the curent
automatic parens feature to the point of disabling it. That is, I like the
auto-parens feature not because it relieves me from having to type closing
parentheses - I don't mind that, and I actually tend to do that
automatically as I'm typing expressions; but the benefit is that it always
keeps parens balanced while I'm still in the middle of typing an
expression. However, with the current behavior, it tends to make me type
extra closing parentheses and have to go back and delete parens to balance
things up again.

So, the questions:

1. Do you use the automatic parentheses feature of DrRacket?

2a. If yes, does the proposal above resonate well with you?
2b. And, do you think this "smart skipping" of auto-inserted closing
parentheses should become the intrinsic behavior of the automatic
parentheses mode, or should it be a separate preference? (i.e. have two
preference options - the current automatic parentheses one and then a
subordinate option that enables/disables this skipping over of
auto-inserted closing parentheses as the user types them)

3. If your answer to #1 is "No", why not? (Is it because you find its
current behavior awkward in some way?)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20121122/e379c053/attachment.html>

Posted on the dev mailing list.