Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

indentation levels with (format ...)

16 views
Skip to first unread message

Masoud Pirnazar

unread,
Aug 28, 2000, 8:05:40 PM8/28/00
to
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?


thi

unread,
Aug 29, 2000, 3:00:00 AM8/29/00
to
Masoud Pirnazar <ampir...@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

Erik Naggum

unread,
Aug 30, 2000, 3:00:00 AM8/30/00
to
* Masoud Pirnazar <ampir...@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.

LaP - Laurent PERON

unread,
Sep 1, 2000, 8:43:45 AM9/1/00
to
thi wrote:

>
> Masoud Pirnazar <ampir...@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)

0 new messages