1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-13 07:10:20 +02:00

(Loading): In %load-hook, need to use set!, and describe #f.

This commit is contained in:
Kevin Ryde 2005-01-14 23:55:07 +00:00
parent 4497bd2f81
commit 42ad91f742

View file

@ -451,19 +451,20 @@ will try each extension automatically.
@end deffn @end deffn
@defvar %load-hook @defvar %load-hook
A procedure to be run whenever @code{primitive-load} is called. If this A procedure to be called @code{(%load-hook @var{filename})} whenever a
procedure is defined, it will be called with the filename argument that file is loaded, or @code{#f} for no such call. @code{%load-hook} is
was passed to @code{primitive-load}. used by all of the above loading functions (@code{load},
@code{load-path}, @code{primitive-load} and
@code{primitive-load-path}).
For example an application can set this to show what's loaded,
@example @example
(define %load-hook (lambda (file) (set! %load-hook (lambda (filename)
(display "Loading ") (format #t "Loading ~a ...\n" filename)))
(display file)
(write-line "...."))) @result{} undefined
(load-from-path "foo.scm") (load-from-path "foo.scm")
@print{} Loading /usr/local/share/guile/site/foo.scm.... @print{} Loading /usr/local/share/guile/site/foo.scm ...
@end example @end example
@end defvar @end defvar
@deffn {Scheme Procedure} current-load-port @deffn {Scheme Procedure} current-load-port