From: Masoud Pirnazar
Subject: indentation levels with (format ...)
Date: 
Message-ID: <39AAFDB2.5B7DD707@poboxes.com>
I'm generating C code from a LISP program, and want to set an
"indentation level" so every time I output carriage-return and then some
text, the text starts at the indentation level.  (e.g. the code
generates an open brace, then increments the indentation level; when it
generates the closing brace, it decrements the indentation level).

Any ideas how to do this cleanly, ideally so I can just call (format
...) without having to call (indent-line-if-necessary) before each new
line?

From: thi
Subject: Re: indentation levels with (format ...)
Date: 
Message-ID: <y16k8czn2uk.fsf@glug.org>
Masoud Pirnazar <··········@poboxes.com> writes:

> Any ideas how to do this cleanly, ideally so I can just call (format
> ...) without having to call (indent-line-if-necessary) before each new
> line?

write out the file, edit it w/ emacs, using `c-indent-exp'.  this is the
approach we use for gratuitous beautification of C-style generated code:

   http://www.scripps.edu/~ttnttn/build/mead/swig/swigpp.el

thi
From: LaP - Laurent PERON
Subject: Re: indentation levels with (format ...)
Date: 
Message-ID: <39AFA481.CF4257BB@free.fr>
thi wrote:
> 
> Masoud Pirnazar <··········@poboxes.com> writes:
> 
> > Any ideas how to do this cleanly, ideally so I can just call (format
> > ...) without having to call (indent-line-if-necessary) before each new
> > line?
> 
> write out the file, edit it w/ emacs, using `c-indent-exp'.  this is the
> approach we use for gratuitous beautification of C-style generated code:

also you could use the `indent' utility.

LaP
-- 
"... By the grace of God Almighty
 And the pressures of the market place
 The human race has civilized itself
 It's a miracle ..."  ("It's A Miracle", Roger Waters, 1988-1991 Pink Floyd
Music Publishers)
From: Erik Naggum
Subject: Re: indentation levels with (format ...)
Date: 
Message-ID: <3176657080550461@naggum.net>
* Masoud Pirnazar <··········@poboxes.com>
| Any ideas how to do this cleanly, ideally so I can just call (format
| ...) without having to call (indent-line-if-necessary) before each
| new line?

  You can use logical blocks in the pretty printer for this.  That
  won't be much different from how the pretty printer does it for
  Lisp, either, so you can probably learn from some relevant code.

#:Erik
-- 
  If this is not what you expected, please alter your expectations.