mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
ease-of-use improvement to ,m; catch read errors at the repl
* module/system/repl/command.scm (module): Accept e.g. `,m ice-9 popen' in addition to `,m (ice-9 popen)'. * module/system/repl/repl.scm (start-repl): Call read with a backtrace handler too.
This commit is contained in:
parent
7e4760e413
commit
482015afec
2 changed files with 6 additions and 2 deletions
|
@ -206,7 +206,9 @@ Quit this session."
|
||||||
Change modules / Show current module."
|
Change modules / Show current module."
|
||||||
(pmatch args
|
(pmatch args
|
||||||
(() (puts (module-name (current-module))))
|
(() (puts (module-name (current-module))))
|
||||||
((,mod-name) (set-current-module (resolve-module mod-name)))))
|
((,mod-name) (guard (list? mod-name))
|
||||||
|
(set-current-module (resolve-module mod-name)))
|
||||||
|
(,mod-name (set-current-module (resolve-module mod-name)))))
|
||||||
|
|
||||||
(define (import repl . args)
|
(define (import repl . args)
|
||||||
"import [MODULE ...]
|
"import [MODULE ...]
|
||||||
|
|
|
@ -105,8 +105,10 @@
|
||||||
(let ((repl (make-repl lang)))
|
(let ((repl (make-repl lang)))
|
||||||
(repl-welcome repl)
|
(repl-welcome repl)
|
||||||
(let prompt-loop ()
|
(let prompt-loop ()
|
||||||
(let ((exp (prompting-meta-read repl)))
|
(let ((exp (call-with-backtrace
|
||||||
|
(lambda () (prompting-meta-read repl)))))
|
||||||
(cond
|
(cond
|
||||||
|
((eqv? exp (if #f #f))) ; read error, pass
|
||||||
((eq? exp meta-command-token)
|
((eq? exp meta-command-token)
|
||||||
(call-with-backtrace
|
(call-with-backtrace
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue