diff options
author | Mark H Weaver <mhw@netris.org> | 2012-11-28 18:01:35 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2012-11-28 21:58:05 -0500 |
commit | bd31bce6ac5df7e45d0ec802d9d0738cbc32d9bf (patch) | |
tree | f519aaa54e6f7743c9551c8d317c2ea6cf30ab1a /doc/ref | |
parent | 99b94347f9c93459e2111e9cacbe3632b8041072 (diff) | |
download | guile-bd31bce6ac5df7e45d0ec802d9d0738cbc32d9bf.tar.gz |
Add parse-path-with-ellipsis, and use it for GUILE_LOAD_PATH et al.
* libguile/load.c (scm_ellipsis): New Variable.
(scm_parse_path_with_ellipsis): New procedure.
(scm_init_load): Initialize 'scm_ellipsis'.
(scm_init_load_path): Use 'scm_parse_path_with_ellipsis' to
handle GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH.
* libguile/load.h (scm_parse_path_with_ellipsis): Add prototype.
* doc/ref/guile-invoke.texi (Environment Variables):
doc/ref/api-evaluation.texi (Load Paths): Add documentation.
Correct description of default load path to reflect reality.
Remove 'GUILE_LOAD_PATH' from the concept index; it is already
in the variable index. Add cross references between these two
sections of the manual.
Diffstat (limited to 'doc/ref')
-rw-r--r-- | doc/ref/api-evaluation.texi | 27 | ||||
-rw-r--r-- | doc/ref/guile-invoke.texi | 25 |
2 files changed, 36 insertions, 16 deletions
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi index 37e41e19a..2e5a3d251 100644 --- a/doc/ref/api-evaluation.texi +++ b/doc/ref/api-evaluation.texi @@ -838,14 +838,16 @@ The procedure in the previous section look for Scheme code in the file system at specific location. Guile also has some procedures to search the load path for code. -@cindex @env{GUILE_LOAD_PATH} @defvar %load-path List of directories which should be searched for Scheme modules and -libraries. @code{%load-path} is initialized when Guile starts up to -@code{(list (%site-dir) (%library-dir) (%package-data-dir))}, prepended -with the contents of the @env{GUILE_LOAD_PATH} environment variable, if -it is set. @xref{Build Config}, for more on @code{%site-dir} and -related procedures. +libraries. When Guile starts up, @code{%load-path} is initialized to +the default load path @code{(list (%library-dir) (%site-dir) +(%global-site-dir) (%package-data-dir))}. The @env{GUILE_LOAD_PATH} +environment variable can be used to prepend or append additional +directories (@pxref{Environment Variables}). + +@xref{Build Config}, for more on @code{%site-dir} and related +procedures. @end defvar @deffn {Scheme Procedure} load-from-path filename @@ -913,7 +915,9 @@ using @code{load-compiled}. @defvar %load-compiled-path Like @code{%load-path}, but for compiled files. By default, this path has two entries: one for compiled files from Guile itself, and one for -site packages. +site packages. The @env{GUILE_LOAD_COMPILED_PATH} environment variable +can be used to prepend or append additional directories +(@pxref{Environment Variables}). @end defvar When @code{primitive-load-path} searches the @code{%load-compiled-path} @@ -943,6 +947,15 @@ a list and return the resulting list with @var{tail} appended. If @var{path} is @code{#f}, @var{tail} is returned. @end deffn +@deffn {Scheme Procedure} parse-path-with-ellipsis path base +@deffnx {C Function} scm_parse_path_with_ellipsis (path, base) +Parse @var{path}, which is expected to be a colon-separated string, into +a list and return the resulting list with @var{base} (a list) spliced in +place of the @code{...} path component, if present, or else @var{base} +is added to the end. If @var{path} is @code{#f}, @var{base} is +returned. +@end deffn + @deffn {Scheme Procedure} search-path path filename [extensions [require-exts?]] @deffnx {C Function} scm_search_path (path, filename, rest) Search @var{path} for a directory containing a file named diff --git a/doc/ref/guile-invoke.texi b/doc/ref/guile-invoke.texi index 08c169864..5a9a3f7ef 100644 --- a/doc/ref/guile-invoke.texi +++ b/doc/ref/guile-invoke.texi @@ -295,8 +295,10 @@ variable. By default, the history file is @file{$HOME/.guile_history}. @vindex GUILE_LOAD_COMPILED_PATH This variable may be used to augment the path that is searched for compiled Scheme files (@file{.go} files) when loading. Its value should -be a colon-separated list of directories, which will be prefixed to the -value of the default search path stored in @code{%load-compiled-path}. +be a colon-separated list of directories. If it contains the special +path component @code{...} (ellipsis), then the default path is put in +place of the ellipsis, otherwise the default path is placed at the end. +The result is stored in @code{%load-compiled-path} (@pxref{Load Paths}). Here is an example using the Bash shell that adds the current directory, @file{.}, and the relative directory @file{../my-library} to @@ -312,18 +314,23 @@ $ guile -c '(display %load-compiled-path) (newline)' @vindex GUILE_LOAD_PATH This variable may be used to augment the path that is searched for Scheme files when loading. Its value should be a colon-separated list -of directories, which will be prefixed to the value of the default -search path stored in @code{%load-path}. +of directories. If it contains the special path component @code{...} +(ellipsis), then the default path is put in place of the ellipsis, +otherwise the default path is placed at the end. The result is stored +in @code{%load-path} (@pxref{Load Paths}). -Here is an example using the Bash shell that adds the current directory -and the parent of the current directory to @code{%load-path}: +Here is an example using the Bash shell that prepends the current +directory to @code{%load-path}, and adds the relative directory +@file{../srfi} to the end: @example -$ env GUILE_LOAD_PATH=".:.." \ +$ env GUILE_LOAD_PATH=".:...:../srfi" \ guile -c '(display %load-path) (newline)' -(. .. /usr/local/share/guile/2.0 \ +(. /usr/local/share/guile/2.0 \ /usr/local/share/guile/site/2.0 \ -/usr/local/share/guile/site /usr/local/share/guile) +/usr/local/share/guile/site \ +/usr/local/share/guile \ +../srfi) @end example (Note: The line breaks, above, are for documentation purposes only, and |