[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pretty printing



Since comments are not part of a Lisp form returned by `read', clearly
no pretty-print function can do what you want.  Certainly a far more
complicated pretty-printer could be written which would be passed an
ascii file to read and which would somehow preserve comments inside the
form in order to regurgitate them during formatting.  The problem has
several complications, however, such as how to handle ascii Lisp text
with conditionalized inclusions (`#+' constructions)...

Instead, what you want is probably provided the Lisp-mode `grind'
facilities available in several popular text editors -- in particular,
EMACS.  (I know CCA EMACS works, and believe Gosling EMACS does also.)
In these editors a couple keystrokes will specify a region of text and
apply one of several Lisp-indentation algorithms to it.  They almost
always indent in reasonable ways, and attempt to do reasonable things
with comments, at least.  The ones with which I am familiar will *not*,
however, adjust line length length by moving either comment or Lisp
text from line to line.  This is not a great problem for normal
human-typed text, such as programs, since one tends not to type
absurdly long lines.