[plt-scheme] How to do this code refactor?

From: Richard Cleis (rcleis at mac.com)
Date: Mon Jul 30 09:01:40 EDT 2007

You don't need to 'cut-and-paste' because m:s:( does not replace the  
selected text.  Furthermore, the cursor is positioned after the new  
opening paren, so you can immediately type 'begin' in the correct place.


PS: Posts can be found in the web archives. :)

On Jul 30, 2007, at 6:45 AM, Grant Rettke wrote:

> Hi folks,
> A while back in an unrelated thread there was an explanation of how to
> do a code refactor of something like this using DrSchemes key
> commands.
> Suppose you have this code:
> (define (hw)
>   (printf "Hello, ")
>   (printf "world."))
> And you want to wrap the printf-s with a begin block.
> My solution was:
> (m:s:right) Select forward sexp
> (c:x) 		Cut
> (m:s:()		Insert matching parentheses
> (c:v)		Paste
> (c:i)		Reformat
> I seem to recall Eli posting a much nicer solution than this, though.
> Anyone remember that post?
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.