Pretty-Print
------------
`(require 'pretty-print)'
- Procedure: pretty-print obj
- Procedure: pretty-print obj port
`pretty-print's OBJ on PORT. If PORT is not specified,
`current-output-port' is used.
Example:
(pretty-print '((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15)
(16 17 18 19 20) (21 22 23 24 25)))
-| ((1 2 3 4 5)
-| (6 7 8 9 10)
-| (11 12 13 14 15)
-| (16 17 18 19 20)
-| (21 22 23 24 25))
- Procedure: pretty-print->string obj
- Procedure: pretty-print->string obj width
Returns the string of OBJ `pretty-print'ed in WIDTH columns. If
WIDTH is not specified, `(output-port-width)' is used.
Example:
(pretty-print->string '((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15)
(16 17 18 19 20) (21 22 23 24 25)))
=>
"((1 2 3 4 5)
(6 7 8 9 10)
(11 12 13 14 15)
(16 17 18 19 20)
(21 22 23 24 25))
"
(pretty-print->string '((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15)
(16 17 18 19 20) (21 22 23 24 25))
16)
=>
"((1 2 3 4 5)
(6 7 8 9 10)
(11
12
13
14
15)
(16
17
18
19
20)
(21
22
23
24
25))
"
`(require 'pprint-file)'
- Procedure: pprint-file infile
- Procedure: pprint-file infile outfile
Pretty-prints all the code in INFILE. If OUTFILE is specified,
the output goes to OUTFILE, otherwise it goes to
`(current-output-port)'.
- Function: pprint-filter-file infile proc outfile
- Function: pprint-filter-file infile proc
INFILE is a port or a string naming an existing file. Scheme
source code expressions and definitions are read from the port (or
file) and PROC is applied to them sequentially.
OUTFILE is a port or a string. If no OUTFILE is specified then
`current-output-port' is assumed. These expanded expressions are
then `pretty-print'ed to this port.
Whitepsace and comments (introduced by `;') which are not part of
scheme expressions are reproduced in the output. This procedure
does not affect the values returned by `current-input-port' and
`current-output-port'.
`pprint-filter-file' can be used to pre-compile macro-expansion and
thus can reduce loading time. The following will write into
`exp-code.scm' the result of expanding all defmacros in `code.scm'.
(require 'pprint-file)
(require 'defmacroexpand)
(defmacro:load "my-macros.scm")
(pprint-filter-file "code.scm" defmacro:expand* "exp-code.scm")