[plt-scheme] ( for [ on the Mac

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Tue Apr 11 00:27:03 EDT 2006


On Mon, 10 Apr 2006, Nicholas Chubrich wrote:

> 	It turns out to be very easy to swap brackets and parentheses on 
> the Mac---and I would highly recommend it to anyone who has had even the 
> slightest pain from typing.

Hi Nicholas,

You might be interested in DivaScheme:

     http://www.cs.brown.edu/research/plt/software/divascheme/

because although it has a voice-recognition interface, it also has a nice 
structured-editor keyboard interface.

In particular, if you press '[', then it'll build a balanced set of 
parens.  I'm still trying to get used to its autocompletion and template 
support --- my Emacs instincts keep getting in the way --- but I think you 
might find it really cool too.


You might also be able to get away with a special user-defined keymap 
specially for DrScheme.  Here you go:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(module rotated-parens-keymap (lib "keybinding-lang.ss" "framework")

   ;; make-handler: string -> handler
   ;; makes a handler that inserts the string s
   (define (make-handler s)
     (lambda (editor event)
       (send editor insert (make-object string-snip% s))))

   ;; Some sample bindings:
   (keybinding "(" (make-handler "{"))
   (keybinding ")" (make-handler "}"))
   (keybinding "[" (make-handler "("))
   (keybinding "]" (make-handler ")"))
   (keybinding "{" (make-handler "["))
   (keybinding "}" (make-handler "]")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

This rotates out the parens, brackets, and braces.  Just install it 
through the Edit/Keybindings/Add user-defined keybindings menus, and you 
should be all set.


Best of wishes!


Posted on the users mailing list.