diff options
Diffstat (limited to 'geiser')
-rw-r--r-- | geiser/emacs.scm | 55 | ||||
-rw-r--r-- | geiser/evaluation.scm | 17 |
2 files changed, 39 insertions, 33 deletions
diff --git a/geiser/emacs.scm b/geiser/emacs.scm index af1a052..73c02d0 100644 --- a/geiser/emacs.scm +++ b/geiser/emacs.scm @@ -10,37 +10,38 @@ ;; Start date: Sun Feb 08, 2009 18:39 (define-module (geiser emacs) - #:re-export (ge:macroexpand - ge:compile-file - ge:load-file - ge:autodoc - ge:completions - ge:module-completions - ge:symbol-location - ge:generic-methods - ge:symbol-documentation - ge:module-exports - ge:module-location - ge:callers - ge:callees - ge:find-file) - #:export (ge:compile - ge:no-values - ge:newline) #:use-module (ice-9 match) + #:use-module (system repl command) + #:use-module (system repl error-handling) #:use-module (geiser evaluation) #:use-module ((geiser modules) :renamer (symbol-prefix-proc 'ge:)) #:use-module ((geiser completion) :renamer (symbol-prefix-proc 'ge:)) #:use-module ((geiser xref) :renamer (symbol-prefix-proc 'ge:)) #:use-module ((geiser doc) :renamer (symbol-prefix-proc 'ge:))) -(define (ge:no-values) (values)) -(define ge:newline newline) - -(define (ge:compile form mod) - (match form - (`((@ (geiser emacs) . ,_) . ,_) (compile/no-warns form mod)) - (_ (compile/warns form mod)))) - - -;;; emacs.scm ends here +(define this-module (resolve-module '(geiser emacs))) + +(define-meta-command ((geiser-no-values geiser) repl) + "geiser-no-values +No-op command used internally by Geiser." + (values)) + +(define-meta-command ((geiser-eval geiser) repl mod form . args) + "geiser-eval +Meta-command used by Geiser to evaluate and compile code." + (if (null? args) + (call-with-error-handling + (lambda () (ge:compile form mod))) + (let ((proc (eval form this-module))) + (ge:eval `(,proc ,@args) mod)))) + +(define-meta-command ((geiser-load-file geiser) repl file) + "geiser-load-file +Meta-command used by Geiser to load and compile files." + (call-with-error-handling + (lambda () (ge:compile-file file)))) + +(define-meta-command ((geiser-newline geiser) repl) + "geiser-newline +Meta-command used by Geiser to emit a new line." + (newline)) diff --git a/geiser/evaluation.scm b/geiser/evaluation.scm index 1cc21a7..ef082db 100644 --- a/geiser/evaluation.scm +++ b/geiser/evaluation.scm @@ -10,8 +10,8 @@ ;; Start date: Mon Mar 02, 2009 02:46 (define-module (geiser evaluation) - #:export (compile/warns - compile/no-warns + #:export (ge:compile + ge:eval ge:macroexpand ge:compile-file ge:load-file @@ -71,10 +71,7 @@ (set! result (thunk))))))) (write-result result output))) -(define (compile/no-warns form module) - (compile* form module '())) - -(define (compile/warns form module) +(define (ge:compile form module) (compile* form module compile-opts)) (define (compile* form module-name opts) @@ -92,6 +89,14 @@ (lambda vs (map object->string vs)))))) (call-with-result ev))) +(define (ge:eval form module-name) + (let* ((module (or (find-module module-name) (current-module))) + (ev (lambda () + (call-with-values + (lambda () (eval form module)) + (lambda vs (map object->string vs)))))) + (call-with-result ev))) + (define (ge:compile-file path) (call-with-result (lambda () |