I agree with all of these issues and your fix. This would get me back to using DrRacket's balanced paren option.
A question: What happens when I type ) when I should type ]? E.g. (cond [(foo x) "one"] [(bar x) "two" |]) where | is the cursor position on the last line there, if I type a ) on accident, will it jump to the outer paren of the (cond ...) block? Will it interpret the keystroke as a ]? Will it signal an error about the parenthesis? Other editors will simply treat the ) as if I'd typed a ] Nadeem Abdul Hamid <nad...@acm.org> writes: > 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 > like: > (+ 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?) > > Thanks, > > nadeem > _________________________ > Racket Developers list: > http://lists.racket-lang.org/dev ____________________ Racket Users list: http://lists.racket-lang.org/users