[plt-scheme] DrScheme now rewrites opening square brackets, too

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Wed Apr 12 07:28:27 EDT 2006

On Tue, Apr 11, 2006 at 06:35:35PM -0500, Robby Findler wrote:
> After reading Neil's web page and seeing mention of smart open parens
> for the second or third time recently, I was inspired to extend
> DrScheme's paren remapping to handle open square brackets (this is not
> what quack does; quack was just the inspiration).
> 
> An excerpt from the (new) manual is below, explaining the particulars.
> 
> Please do let me know if you find a case where DrScheme is being too
> agressive about changing the parens. Otherwise, do try to get used to
> typing only (the hopefully unshifted on your keyboard too) [] from now
> on.

<SNIP>

Cool!  That'll be nice to use!

Is there a way to tell DrScheme that, in this one instance, I really
want an open square bracket?  Something like C-q [ in Emacs, for
instance.  (This may actually work already; I haven't tried this out.)

In addition to the cases you mentioned, Robby, I tend to use square
brackets to group things that are not themselves applications or special
forms:

    (provide/contract [f (integer? . -> . integer?)]
                      [g (integer? string? . -> . char?)])

    (hash-table ['key value] ['key-2 value-2] ...)

And so on.  Unfortunately, since these situations usually arise in macro
arguments---and because I like to do this with macros that I write---I
don't think we can expect DrScheme to recognize these situations and Do
the Right Thing automatically.  Thus, something like C-q would be nice.

Richard


Posted on the users mailing list.