read: Accept "\|" in string literals.
[bpt/guile.git] / doc / ref / scheme-using.texi
index 2713fab..4422c18 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
-@c Copyright (C) 2006, 2010, 2011
+@c Copyright (C) 2006, 2010, 2011, 2012, 2013
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -125,7 +125,7 @@ The programmatic interface to value history is in a module:
 @end lisp
 
 @deffn {Scheme Procedure} value-history-enabled?
-Return true iff value history is enabled.
+Return true if value history is enabled, or false otherwise.
 @end deffn
 
 @deffn {Scheme Procedure} enable-value-history!
@@ -230,7 +230,7 @@ Show description/documentation.
 Change modules / Show current module.
 @end deffn
 
-@deffn {REPL Command} import [module ...]
+@deffn {REPL Command} import module @dots{}
 Import modules / List those imported.
 @end deffn
 
@@ -247,7 +247,7 @@ List current bindings.
 @end deffn
 
 @deffn {REPL Command} in module expression
-@deffnx {REPL Command} in module command [args ...]
+@deffnx {REPL Command} in module command arg @dots{}
 Evaluate an expression, or alternatively, execute another meta-command
 in the context of a module.  For example, @samp{,in (foo bar) ,binding}
 will show the bindings in the module @code{(foo bar)}.
@@ -298,8 +298,13 @@ Time execution.
 Profile execution.
 @end deffn
 
-@deffn {REPL Command} trace exp
+@deffn {REPL Command} trace exp [#:width w] [#:max-indent i]
 Trace execution.
+
+By default, the trace will limit its width to the width of your
+terminal, or @var{width} if specified.  Nested procedure invocations
+will be printed farther to the right, though if the width of the
+indentation passes the @var{max-indent}, the indentation is abbreviated.
 @end deffn
 
 @node Debug Commands
@@ -311,7 +316,7 @@ they do not work at the top level.
 @deffn {REPL Command} backtrace [count] [#:width w] [#:full? f]
 Print a backtrace.
 
-Print a backtrace of all stack frames, or innermost @var{COUNT} frames.
+Print a backtrace of all stack frames, or innermost @var{count} frames.
 If @var{count} is negative, the last @var{count} frames will be shown.
 @end deffn
 
@@ -406,11 +411,11 @@ reenter the REPL.
 @node Inspect Commands
 @subsubsection Inspect Commands
 
-@deffn {REPL Command} inspect EXP
+@deffn {REPL Command} inspect exp
 Inspect the result(s) of evaluating @var{exp}.
 @end deffn
 
-@deffn {REPL Command} pretty-print EXP
+@deffn {REPL Command} pretty-print exp
 Pretty-print the result(s) of evaluating @var{exp}.
 @end deffn
 
@@ -425,8 +430,11 @@ Garbage collection.
 Display statistics.
 @end deffn
 
-@deffn {REPL Command} option [key value]
-List/show/set options.
+@deffn {REPL Command} option [name] [exp]
+With no arguments, lists all options.  With one argument, shows the
+current value of the @var{name} option.  With two arguments, sets the
+@var{name} option to the result of evaluating the Scheme expression
+@var{exp}.
 @end deffn
 
 @deffn {REPL Command} quit
@@ -445,6 +453,10 @@ choice is available.  Off by default (indicating compilation).
 @item prompt
 A customized REPL prompt.  @code{#f} by default, indicating the default
 prompt.
+@item print
+A procedure of two arguments used to print the result of evaluating each
+expression.  The arguments are the current REPL and the value to print.
+By default, @code{#f}, to use the default procedure.
 @item value-history
 Whether value history is on or not.  @xref{Value History}.
 @item on-error
@@ -457,7 +469,7 @@ show a short error printout.
 Default values for REPL options may be set using
 @code{repl-default-option-set!} from @code{(system repl common)}:
 
-@deffn {Scheme Procedure} repl-set-default-option! key value
+@deffn {Scheme Procedure} repl-default-option-set! key value
 Set the default value of a REPL option.  This function is particularly
 useful in a user's init file.  @xref{Init File}.
 @end deffn
@@ -732,6 +744,66 @@ using a CPAN-like system.
 A complete list of guild scripts can be had by invoking @code{guild
 list}, or simply @code{guild}.
 
+
+@node Installing Site Packages
+@section Installing Site Packages
+
+@cindex site
+@cindex site path
+@cindex load path
+@findex %site-dir
+@findex %site-ccache-dir
+
+At some point, you will probably want to share your code with other
+people.  To do so effectively, it is important to follow a set of common
+conventions, to make it easy for the user to install and use your
+package.
+
+The first thing to do is to install your Scheme files where Guile can
+find them.  When Guile goes to find a Scheme file, it will search a
+@dfn{load path} to find the file: first in Guile's own path, then in
+paths for @dfn{site packages}.  A site package is any Scheme code that
+is installed and not part of Guile itself.  @xref{Load Paths}, for more
+on load paths.
+
+There are several site paths, for historical reasons, but the one that
+should generally be used can be obtained by invoking the
+@code{%site-dir} procedure.  @xref{Build Config}.  If Guile
+@value{EFFECTIVE-VERSION} is installed on your system in @code{/usr/},
+then @code{(%site-dir)} will be
+@code{/usr/share/guile/site/@value{EFFECTIVE-VERSION}}.  Scheme files
+should be installed there.
+
+If you do not install compiled @code{.go} files, Guile will compile your
+modules and programs when they are first used, and cache them in the
+user's home directory.  @xref{Compilation}, for more on
+auto-compilation.  However, it is better to compile the files before
+they are installed, and to just copy the files to a place that Guile can
+find them.
+
+As with Scheme files, Guile searches a path to find compiled @code{.go}
+files, the @code{%load-compiled-path}.  By default, this path has two
+entries: a path for Guile's files, and a path for site packages.  You
+should install your @code{.go} files into the latter directory, whose
+value is returned by invoking the @code{%site-ccache-dir} procedure.  As
+in the previous example, if Guile @value{EFFECTIVE-VERSION} is installed
+on your system in @code{/usr/}, then @code{(%site-ccache-dir)} site
+packages will be
+@code{/usr/lib/guile/@value{EFFECTIVE-VERSION}/site-ccache}.
+
+Note that a @code{.go} file will only be loaded in preference to a
+@code{.scm} file if it is newer.  For that reason, you should install
+your Scheme files first, and your compiled files second.  @code{Load
+Paths}, for more on the loading process.
+
+Finally, although this section is only about Scheme, sometimes you need
+to install C extensions too.  Shared libraries should be installed in
+the @dfn{extensions dir}.  This value can be had from the build config
+(@pxref{Build Config}).  Again, if Guile @value{EFFECTIVE-VERSION} is
+installed on your system in @code{/usr/}, then the extensions dir will
+be @code{/usr/lib/guile/@value{EFFECTIVE-VERSION}/extensions}.
+
+
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End: