diff options
-rw-r--r-- | elisp/geiser-eval.el | 1 | ||||
-rw-r--r-- | elisp/geiser-racket.el | 7 | ||||
-rw-r--r-- | scheme/racket/geiser.rkt | 1 | ||||
-rw-r--r-- | scheme/racket/geiser/eval.rkt | 9 | ||||
-rw-r--r-- | scheme/racket/geiser/modules.rkt | 2 | ||||
-rw-r--r-- | scheme/racket/geiser/user.rkt | 22 |
6 files changed, 28 insertions, 14 deletions
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el index df31594..ffe3306 100644 --- a/elisp/geiser-eval.el +++ b/elisp/geiser-eval.el @@ -113,6 +113,7 @@ module-exports, autodoc, callers, callees and generic-methods.") (mapconcat 'geiser-eval--scheme-str code " ") ")")))) ((symbolp code) (format "%s" code)) + ((stringp code) (format "%S" (substring-no-properties code))) (t (format "%S" code)))) diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el index 0508d6c..cd4cc8a 100644 --- a/elisp/geiser-racket.el +++ b/elisp/geiser-racket.el @@ -98,12 +98,12 @@ This function uses `geiser-racket-init-file' if it exists." (defun geiser-racket--geiser-procedure (proc &rest args) (case proc ((eval compile) - (format ",geiser-eval %s %s %s" + (format ",geiser-eval %s %s %s\n" (or (car args) "#f") (geiser-racket--language) (mapconcat 'identity (cdr args) " "))) ((load-file compile-file) - (format ",geiser-eval geiser/main racket (geiser:%s %s)" + (format ",geiser-eval geiser/main racket (geiser:%s %s)\n" proc (car args))) ((no-values) ",geiser-no-values") (t (format ",apply geiser:%s (%s)" proc (mapconcat 'identity args " "))))) @@ -150,7 +150,8 @@ This function uses `geiser-racket-init-file' if it exists." (format "(require %s)" module))) (defun geiser-racket--exit-command () - (not (geiser-eval--send/result '(:eval (exit) geiser/emacs)))) + (comint-send-eof) + (get-buffer-process (current-buffer))) (defconst geiser-racket--binding-forms '(for for/list for/hash for/hasheq for/and for/or diff --git a/scheme/racket/geiser.rkt b/scheme/racket/geiser.rkt index 1ab7983..44a2ed8 100644 --- a/scheme/racket/geiser.rkt +++ b/scheme/racket/geiser.rkt @@ -20,5 +20,6 @@ (require errortrace) (require geiser/user) +(init-geiser-repl) ;;; geiser.rkt ends here diff --git a/scheme/racket/geiser/eval.rkt b/scheme/racket/geiser/eval.rkt index 4e7f3db..66eccc6 100644 --- a/scheme/racket/geiser/eval.rkt +++ b/scheme/racket/geiser/eval.rkt @@ -55,10 +55,11 @@ (append last-result `((output . ,output))))) (define (eval-in form spec lang) - (call-with-result - (lambda () - (update-signature-cache spec form) - (eval form (module-spec->namespace spec lang))))) + (write (call-with-result + (lambda () + (update-signature-cache spec form) + (eval form (module-spec->namespace spec lang))))) + (newline)) (define compile-in eval-in) diff --git a/scheme/racket/geiser/modules.rkt b/scheme/racket/geiser/modules.rkt index 9b640ec..5c6ba1f 100644 --- a/scheme/racket/geiser/modules.rkt +++ b/scheme/racket/geiser/modules.rkt @@ -74,7 +74,7 @@ (call-with-values (lambda () (split-path path)) (lambda (_ basename __) (path->string basename))) (regexp-replace "\\.[^./]*$" real-path "")))] - [(eq? path '#%kernel) "(kernel)"] + ;; [(eq? path '#%kernel) "(kernel)"] [(string? path) path] [(symbol? path) (symbol->string path)] [else ""])) diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt index 20f8a00..88cc24c 100644 --- a/scheme/racket/geiser/user.rkt +++ b/scheme/racket/geiser/user.rkt @@ -11,7 +11,7 @@ #lang racket/base -(provide enter!) +(provide init-geiser-repl run-geiser-repl enter!) (require geiser/main geiser/enter geiser/eval (for-syntax racket/base)) @@ -29,6 +29,7 @@ mod)))) (define orig-loader (current-load/use-compiled)) +(define geiser-loader (module-loader orig-loader)) (define orig-reader (current-prompt-read)) @@ -56,10 +57,19 @@ (else form))) (_ form)))) -(define (init) +(define geiser-prompt-read + (compose (make-repl-reader geiser-read) current-namespace)) + +(define (init-geiser-repl) (compile-enforce-module-constants #f) - (current-load/use-compiled (module-loader orig-loader)) - (current-prompt-read - (compose (make-repl-reader geiser-read) current-namespace))) + (current-load/use-compiled geiser-loader) + (current-prompt-read geiser-prompt-read)) -(init) +(define (run-geiser-repl in out (enforce-module-constants #f)) + (parameterize [(compile-enforce-module-constants enforce-module-constants) + (current-input-port in) + (current-output-port out) + (current-error-port out) + (current-load/use-compiled geiser-loader) + (current-prompt-read geiser-prompt-read)] + (read-eval-print-loop))) |