[comp.lang.lisp] SUMMARY--reindentation and pretty-printing for Scheme

dak@sq.sq.com (David A Keldsen) (06/12/90)

OK, here's the promised summary.  Thanks to all the folks who replied
(quickly, too!).

Fast overview:  
Emacs and vi can re-indent; emacs can do it in batch mode; fools lisp
has pretty-printing code.  A standalone re-indenter in C by
wri!henry@uunet.uu.net is posted as a follow-up to this posting, in
comp.lang.scheme only.

Detailed summary:
John R. Ellis (ellis@src.dec.com) points out that my initial request is
ambiguous.  Pretty-printers and a re-indenters are quite different
beasts.  A *pretty printer* is either a print procedure for an internal
form, or is a code reformatter that is permitted to re-arrange the
code.  A *re-indenter* merely re-adjusts the indentation, and is not
permitted to change the line splits.

mob@media-lab.media.mit.edu, alms@cambridge.apple.com (Andrew L. M. Shalit),
ted@NMSU.Edu, rees@parc.xerox.com, vladimir@Eng.Sun.COM (Vladimir G. Ivanovic) 
and Keiji Kanazawa <kgk@cs.brown.edu> all suggested Emacs.
(This was before my revised specification that the code be free of
encumbrances, small, and portable).  For those free of these
specifications, it was also noted that GNU emacs can be fired up in
batch mode, for use as a stand-alone indenter.

Tim Bradshaw <tim@cstr.edinburgh.ac.uk> offered the suggestion that in
Common Lisp, it is easy to redefine the read table to keep comments (as
asked in my second request).  This isn't in the standard for Scheme,
but it is supported in some implementations.  donc@vaxa.isi.edu (Don
Cohen) also suggested the readtable solution.

J. A. Durieux <xerox@cs.vu.nl> and Jeff Mantei <uiucdcs!cs.uiuc.edu!mantei> 
both pointed out that vi has a lisp mode (:set lisp), and that =<addr>
will lisp-indent the specified lines.  =% was suggested as being
especially useful; it re-indents to the matching parenthesis.  (Note
also that vi will start up in lisp mode, with auto-indent set, and
show-matching-parentheses, if you use the -l option).

Ozan Yigit <oz@nexus.yorku.ca> noted that the fools lisp distribution
by Jonathan Lee (jonathan@scam.berkeley.edu) contains some nice
pretty-printing code.

And finally, wri!henry@uunet.uu.net sent the stand-alone re-indentation
code, which I am posting as a follow-up to this article, in
comp.lang.scheme only.
-- 
// David A. 'Dak' Keldsen:  dak@sq.com or utai[.toronto.edu]!sq!dak
// "I have heard the mermaids singing, each to each."  -- T.S.Eliot