branch: elpa/geiser-gauche commit 40f48867998ba1c685ff585c611d9430e41c65cc Author: András Simonyi <andras.simo...@gmail.com> Commit: András Simonyi <andras.simo...@gmail.com>
Implement eval error message --- geiser-gauche.el | 13 ++++++++++++- geiser.scm | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/geiser-gauche.el b/geiser-gauche.el index 04c8ca6..5782248 100644 --- a/geiser-gauche.el +++ b/geiser-gauche.el @@ -227,8 +227,19 @@ (compilation-setup t) (geiser-eval--send/wait "(newline)"))) + +;;; Error display + (defun geiser-gauche--display-error (module key msg) - (and key (message msg) nil)) + (when key + (insert key) + (save-excursion + (goto-char (point-min)) + (re-search-forward "report-error err #f") + (kill-whole-line 2))) + (when msg + (insert msg)) + (if (and msg (string-match "\\(.+\\)$" msg)) (match-string 1 msg) key)) ;;; Manual look up diff --git a/geiser.scm b/geiser.scm index 63be94f..ff24735 100644 --- a/geiser.scm +++ b/geiser.scm @@ -59,17 +59,19 @@ (cut pprint (macroexpand form)))) (define (geiser:eval module-name form . rest) - ;; (call-with-output-file "/tmp/gauche.log" - ;; (^o (format o "FORM: ~s, REST: ~s" form rest))) - (let* ((output (open-output-string)) - (module (or (and (symbol? module-name ) - (find-module module-name)) - (find-module 'user))) - (result (with-output-to-port output - (lambda () - (eval form module))))) - (write `((result ,(write-to-string result)) - (output . ,(get-output-string output)))))) + rest + (guard (err + (else + (write + `((error (key . ,(report-error err #f))))))) + (let* ((output (open-output-string)) + (module (or (and (symbol? module-name ) + (find-module module-name)) + (find-module 'user))) + (result (with-output-to-port output + (^ () (eval form module))))) + (write `((result ,(write-to-string result)) + (output . ,(get-output-string output))))))) (define (geiser:load-file filename . rest) (geiser:eval 'user `(load ,filename))) @@ -137,7 +139,7 @@ ;;;; Autodoc -(define (geiser:autodoc symbols pref-module) +(define (geiser:autodoc symbols pref-module . rest) (map (cut formatted-autodoc <> pref-module) symbols)) @@ -262,5 +264,3 @@ ;;; TODO We add the load-path at the end. Is this correct? (define-macro (geiser:add-to-load-path dir) `(add-load-path ,dir :after)) - -