Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!uhog.mit.edu!europa.eng.gtefsd.com!howland.reston.ans.net!news.sprintlink.net!EU.net!uknet!festival!edcogsci!usenet
From: tfb@cogsci.ed.ac.uk (Tim Bradshaw)
Subject: Prettyprinting comments with XP in CL
Message-ID: <TFB.94Oct25184148@scott.cogsci.ed.ac.uk>
Sender: usenet@cogsci.ed.ac.uk (C News Software)
Nntp-Posting-Host: scott
Organization: Centre for Cognitive Science, University of Edinburgh
Date: Tue, 25 Oct 1994 18:41:48 GMT
Lines: 32

I want to be able to prettyprint CL code into HTML files, with
comments.  I have some read macros that read comments into a structure
that looks like:

 (defstruct comment
   (semis 0 :type fixnum)		; semicolon count
   (body nil :type list))		; list of lines

so, for instance

  ;; this is line one
  ;; line 2
  ;;; another comment

is read as two COMMENT structures with semis of 2 and 3 resp, where
the first has 2 lines, the second 1.

OK, now I want to be able to print these things, preferably without
writing my own pretty printer! I'm trying to use XP.

The problem is that it *must* be the case that the lines of a comment
are on their own lines: I have to force a newline.  But, *if* I
understand XP, there is no way of doing this without causing all the
other conditional newlines into real ones, and ending up with terribly
formatted code.

Does anyone have any ideas how I can do this properly with XP?  Has
anyone done such?

Thanks,

--tim
