From: John Atwood
Subject: Pretty printer and comments?
Date: 
Message-ID: <7rbrjh$1ad$1@news.NERO.NET>
In another thread, I wrote:
>> I'm also trying to find out how to read/write comments and 
>> how to use the pretty-printer in general, but i'll start 
>> another thread for that.

To which Kent M Pitman  <······@world.std.com> replied:                     
>You'll have to write your own reader to read/write comments.  
>You almost surely don't want to do that. I really think this is 
>the wrong technology for what you want to do.  Learn how to 
>program Emacs-Lisp and just use its identing capabilities as part 
>of a batch script.  (Emacs-Lisp can be invoked from the command 
>line, and so can be called from a CL as a subroutine if you need 
>to by calling out to the system.)  But, also, if you have code 
>you need to see pretty printed, the simplest solution is to
>make sure it is always pretty printed to begin with.  If it has 
>comments, it was probably created by a human, and there's no 
>good reason for it to not be pretty printed.  Mostly I really 
>suspect there are better things you could be doing with your 
>precious days on earth than writing this particular program.

Seems like all the pieces are there: the Pretty Printer and the 
reader. I haven't read Water's papers on XP, but chapter 27 of Steele 
and 22 of your HyperSpec led to me to believe it would be the right
technology. It's very disappointing to hear that you think it's not.

You're right, I'd don't want to write that program, but neither 
do I want to learn Emacs (I tried and failed many years ago) much 
less learn to program it, also my current (Nedit, TextPad, AlphaTk, 
wily). editors handle Lisp fairly well (matching parentheses, etc). 

As for "no good reasion for it not to be pretty printed", one of 
my aims here is to accomodate different religions concerning 
indentation.


As for comments, I envisioned rules something like:

  1) For #| Comments, format everything inside as though it were 
         uncommented
  2) For double semi-colons, indent it the same as the next s-expr.
  3) For single semi-colons, if it's in-line, i.e., not the first
         non-whitespace character on a line leave it alone, 
         otherwise treat as case #2
  4) For triple semi-colons, flush left


Thanks for the idea of using Emacs in batch mode, I may pursue that.



John Atwood