summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-07-02 05:29:04 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-07-02 05:29:04 +0200
commitbdd12279d05fd5451b186d2da9f1a864f1d1a0f9 (patch)
tree50474729981cd8d9f8b286879a2b15fdd245754e
parente01166f7d2f3551596a04474a76f4811fc841edc (diff)
downloadgeiser-bdd12279d05fd5451b186d2da9f1a864f1d1a0f9.tar.gz
geiser-bdd12279d05fd5451b186d2da9f1a864f1d1a0f9.tar.bz2
Simpler, nicer, more efficient handling of evaluation results. It
comes with a pony too.
-rw-r--r--elisp/geiser-connection.el1
-rw-r--r--elisp/geiser-debug.el10
-rw-r--r--elisp/geiser-eval.el9
-rw-r--r--elisp/geiser-syntax.el10
4 files changed, 15 insertions, 15 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 0ec6405..4f8592b 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -165,7 +165,6 @@
(goto-char (point-min))
(re-search-forward "((\\(result\\|error\\)\\>")
(goto-char (match-beginning 0))
- (geiser-syntax--prepare-scheme-for-elisp-reader)
(let ((form (read (current-buffer))))
(if (listp form) form (error))))
(error `((error (key . geiser-con-error))
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el
index ec2e93e..6d795df 100644
--- a/elisp/geiser-debug.el
+++ b/elisp/geiser-debug.el
@@ -59,7 +59,7 @@
;;; Displaying retorts
-(defun geiser-debug--display-retort (what ret)
+(defun geiser-debug--display-retort (what ret &optional res)
(let* ((err (geiser-eval--retort-error ret))
(key (geiser-eval--error-key err))
(output (geiser-eval--retort-output ret))
@@ -69,6 +69,9 @@
(erase-buffer)
(insert what)
(newline 2)
+ (when res
+ (insert res)
+ (newline 2))
(unless (geiser-impl--display-error impl module key output)
(when err (insert (geiser-eval--error-str err) "\n\n"))
(when output (insert output "\n\n")))
@@ -88,10 +91,11 @@
(wrapped (if wrap (geiser-debug--wrap-region str) str))
(code `(,(if compile :comp :eval) (:scm ,wrapped)))
(ret (geiser-eval--send/wait code))
+ (res (geiser-eval--retort-result-str ret))
(err (geiser-eval--retort-error ret)))
(when and-go (funcall and-go))
- (when (not err) (message (format "=> %S" (geiser-eval--retort-result ret))))
- (geiser-debug--display-retort str ret)))
+ (when (not err) (message "%s" res))
+ (geiser-debug--display-retort str ret res)))
(defun geiser-debug--expand-region (start end all wrap)
(let* ((str (buffer-substring-no-properties start end))
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index 90be67c..428d057 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -145,7 +145,14 @@ EVAL, COMPILE, LOAD-FILE and COMPILE-FILE should be supported."))
(defun geiser-eval--retort-result (ret)
(let ((values (cdr (assoc 'result ret))))
- (if (> (length values) 1) (cons :values values) (car values))))
+ (and (stringp (car values))
+ (ignore-errors (car (read-from-string (car values)))))))
+
+(defun geiser-eval--retort-result-str (ret)
+ (let ((values (cdr (assoc 'result ret))))
+ (if values
+ (concat "=> " (mapconcat 'identity values "\n=> "))
+ "(No value)"))))
(defsubst geiser-eval--retort-output (ret) (cdr (assoc 'output ret)))
(defsubst geiser-eval--retort-error (ret) (cdr (assoc 'error ret)))
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index c70aacb..db1c842 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -84,16 +84,6 @@
(geiser-popup--define syntax " *geiser syntax analyst*" scheme-mode)
-(defun geiser-syntax--prepare-scheme-for-elisp-reader ()
- (let ((end (save-excursion
- (goto-char (point-max))
- (and (re-search-backward "(output \\. \"" nil t)
- (point)))))
- (save-excursion
- (while (re-search-forward "#(" end t) (replace-match "(vector "))
- (goto-char (point-min))
- (while (re-search-forward "#" end t) (replace-match "\\\\#")))))
-
(defsubst geiser-syntax--del-sexp (arg)
(let ((p (point)))
(forward-sexp arg)