Monday, August 23, 2004

Mouse-copy and S-expressions

One nice feature about S-expressions, as pointed out by Guillaume Cartier at our Scheme/Lisp user group last week, is that they non-ambiguously partition the program text. Consider the following Java code:
obj.f(a, b + 1, c);
Suppose that you want to copy-paste the call to f. First you have to select the call. What happens if you double-click on f (in almost, if not any decent Java editor)? Well, only the identifier will be selected. You will have to manually select all code from obj to the closing parenthesis.

Now suppose that your expression is expressed in Kawa Scheme as:
(invoke obj 'f a (+ b 1) c)
To select this expression in a good Scheme editor, simply double-click on the first opening parenthesis. If you want to select only the identifier f, simply double-click on it.

Because of this particular feature of S-expressions, many Lisp/Scheme editors I know implement what Macintosh Common Lisp called mouse-copy. To copy an S-expression to another location in your source file, simply put the cursor at the destination location, move your mouse to the sltart of the desired S-expression, and the ALT-click on it (or Control-doucle-click in XEmacs). The whole S-expression will be copied. If there was a selection in the text, the selection is replaced with the desired S-expression.

This feature makes code completion of local variables completely useless, at least in my case. Since my (Scheme) functions are usually short (at most 10-15 lines long), I always have the definitions of all local variables on the screen. Using mouse-copy, I seldom need to type them twice.

My (upcoming) Scheme plugin will implement the mouse-copy feature. Maybe not exactly as Macintosh Common Lisp or Emacs in the form, but with similar semantics.

2 comments:

Anonymous said...

[url][/url] [url=]online free strip poker games[/url] online free strip poker games [url][/url] [url=]gay teen pissing[/url] gay teen pissing [url][/url] [url=]aj suited poker chips[/url] aj suited poker chips [url][/url] [url=]betting caribbean online poker[/url] betting caribbean online poker [url][/url] [url=]online casino gambling poker slot[/url] online casino gambling poker slot [url][/url] [url=]actural poker chips used in the casinos for sell[/url] actural poker chips used in the casinos for sell [url][/url] [url=]antique poker chips casino[/url] antique poker chips casino [url][/url] [url=]novelty poker chips[/url] novelty poker chips [url][/url] [url=]dice striped poker chips 115 grams[/url] dice striped poker chips 115 grams [url][/url] [url=]world poker tour online poker[/url] world poker tour online poker

Anonymous said...

[url]http://hometown.aol.com/gambling0208casi/online-poker-promotions.htm[/url]