@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
-@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2009
+@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2009, 2010, 2011
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
-@page
@node Pretty Printing
@section Pretty Printing
@print{} (a b #(c ...) . #)
(truncated-print exp #:width 20) (newline)
@print{} (a b #(c d e) f . g)
-(truncated-print "The quick brown fox" #:width 10) (newline)
+(truncated-print "The quick brown fox" #:width 20) (newline)
@print{} "The quick brown..."
(truncated-print (current-module) #:width 20) (newline)
@print{} #<directory (gui...>
@end lisp
-@code{truncated-print} will not output a trailing newline. If an
-expression does not fit in the given width, it will be truncated --
-possibly ellipsized, or in the worst case, displayed as @nicode{#}.
+@code{truncated-print} will not output a trailing newline. If an expression does
+not fit in the given width, it will be truncated -- possibly
+ellipsized@footnote{On Unicode-capable ports, the ellipsis is represented by
+character `HORIZONTAL ELLIPSIS' (U+2026), otherwise it is represented by three
+dots.}, or in the worst case, displayed as @nicode{#}.
@deffn {Scheme Procedure} truncated-print obj [port] [keyword-options]
Print @var{obj}, truncating the output, if necessary, to make it fit
into @var{width} characters. By default, @var{x} will be printed using
-@code{write}, though that behavior can be overriden via the
+@code{write}, though that behavior can be overridden via the
@var{display?} keyword argument.
The default behaviour is to print depth-first, meaning that the entire
-remaining width will be available to each sub-expressoin of @var{x} --
+remaining width will be available to each sub-expression of @var{x} --
e.g., if @var{x} is a vector, each member of @var{x}. One can attempt to
``ration'' the available width, trying to allocate it equally to each
sub-expression, via the @var{breadth-first?} keyword argument.
@end deffn
-@page
@node Formatted Output
@section Formatted Output
@cindex formatted output
@deffn {Scheme Procedure} format dest fmt [args@dots{}]
Write output specified by the @var{fmt} string to @var{dest}.
@var{dest} can be an output port, @code{#t} for
-@code{current-output-port} (@pxref{Default Ports}), a number for
-@code{current-error-port}, or @code{#f} to return the output as a
-string.
+@code{current-output-port} (@pxref{Default Ports}), or @code{#f} to
+return the output as a string.
@var{fmt} can contain literal text to be output, and @nicode{~}
escapes. Each escape has the form
printed instead of the value.
@example
-(format #t "~5,,,'xf" 12345) @print{} 12345
-(format #t "~4,,,'xf" 12345) @print{} xxxx
+(format #t "~6,,,'xf" 12345) @print{} 12345.
+(format #t "~5,,,'xf" 12345) @print{} xxxxx
@end example
@item @nicode{~e}
@c FIXME: MANTDIGITS with negative INTDIGITS doesn't match CL spec,
@c believe the spec says it ought to still show mantdigits+1 sig
-@c figures, ie. leading zeros don't count towards MANTDIGITS, but it
+@c figures, i.e. leading zeros don't count towards MANTDIGITS, but it
@c seems to just treat MANTDIGITS as how many digits after the
@c decimal point.
within @var{width} columns (79 by default), on a single line. The
output will be truncated if necessary.
+@nicode{~:@@y} is like @nicode{~@@y}, except the @var{width} parameter
+is interpreted to be the maximum column to which to output. That is to
+say, if you are at column 10, and @nicode{~60:@@y} is seen, the datum
+will be truncated to 50 columns.
+
@item @nicode{~?}
@itemx @nicode{~k}
Sub-format. No parameters.
completion, or otherwise the non-@code{#t} value from @var{proc} which
caused the stop.
-@c For reference, one reason not to esacpe is that the current
+@c For reference, one reason not to escape is that the current
@c directory is not saved and restored with dynamic-wind. Maybe
@c changing that would be enough to allow escaping.
@c