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

Re: format directive problem



Hi-

Format directives can be confusing.

First of all, if what you want is wrapped and indented text, then have
a look at the following directives: ~T, ~I, ~< with ~:>, and the chapter
in CLtl2 on pretty-printing.

Although you can put ~newline almost anywhere, I don't usually see
them in the middle of a directive; this may be what's causing the
error in your code.  This makes sense to me, each directive is sort of
an atomic command on its own.  On the other hand, even if it were
processed the way one might think (just remove the
~<newline><whitespace> it is still an error in your example. If you
just take out the ~<newline> and following whitespace from your code,
you get this (pardon the long line.....).  It generates an error
different from yours above:

? (format nil "What a nice text!~%~a lines will be fine ~:@but I write only 2.~2% (click to close ...)" 4)

> Error: 
>        Missing argument
>        "What a nice text!~%~a lines will be fine ~:@but I write only
2.~2% (click to close ...)"
>                                                     ^
>        
> While executing: CCL::DO-SUB-FORMAT
> Type Command-. to abort.
See the RestartsI menu item for further choices.
1 > 

(Here, you actually have a ~:@b command which is looking for an
argument, to be printed as a binary number.)

If what you want is text on one line, just use ~<newline>:

? (format nil "What a nice text!~%~a lines will be fine ~
             but I write only 2.~2% (click to close ...)" 4)

"What a nice text!
4 lines will be fine but I write only 2.

 (click to close ...)"

I'm no guru, but I've got a few hairy format strings to work in my
time.  I'm not sure exactly what you want to achieve.  Why don't you
send me your code-fragment together with your *desired* output and
I'll see if I can help.


Ethan

Ethan Benatan
ethan+@pitt.edu
http://www.pitt.edu/~ethan/home.html