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

add ,reload meta-command and document it and reload-module

* module/ice-9/boot-9.scm (reload-module): Add docstring.
* module/system/repl/command.scm (reload): New meta-command.

* doc/ref/scheme-using.texi (Module Commands): Document the ,reload
  meta-command.
* doc/ref/api-modules.texi (Module System Reflection): Document
  reload-module.
This commit is contained in:
Andy Wingo 2010-12-17 13:27:43 +01:00
parent 626e36e5cb
commit cdab9fc625
4 changed files with 20 additions and 1 deletions

View file

@ -563,6 +563,11 @@ arguments should be module objects, and @var{interface} should very
likely be a module returned by @code{resolve-interface}.
@end deffn
@deffn {Scheme Procedure} reload-module module
Revisit the source file that corresponds to @var{module}. Raises an
error if no source file is associated with the given module.
@end deffn
@node Included Guile Modules
@subsection Included Guile Modules

View file

@ -223,6 +223,10 @@ Import modules / List those imported.
Load a file in the current module.
@end deffn
@deffn {REPL Command} reload [module]
Reload the given module, or the current module if none was given.
@end deffn
@deffn {REPL Command} binding
List current bindings.
@end deffn

View file

@ -2276,6 +2276,7 @@ VALUE."
(try-module-autoload name version))
(define (reload-module m)
"Revisit the source file corresponding to the module @var{m}."
(let ((f (module-filename m)))
(if f
(save-module-excursion

View file

@ -50,7 +50,7 @@
(define *command-table*
'((help (help h) (show) (apropos a) (describe d))
(module (module m) (import use) (load l) (binding b) (in))
(module (module m) (import use) (load l) (reload re) (binding b) (in))
(language (language L))
(compile (compile c) (compile-file cc)
(disassemble x) (disassemble-file xx))
@ -391,6 +391,15 @@ Import modules / List those imported."
Load a file in the current module."
(load (->string file)))
(define-meta-command (reload repl . args)
"reload [MODULE]
Reload the given module, or the current module if none was given."
(pmatch args
(() (reload-module (current-module)))
((,mod-name) (guard (list? mod-name))
(reload-module (resolve-module mod-name)))
(,mod-name (reload-module (resolve-module mod-name)))))
(define-meta-command (binding repl)
"binding
List current bindings."