Permalink
Browse files

Improve Scheme eval printing

Pressing "e" on:

    (begin
      (display "test")
      (+ 2 2))

will now result in a better output.
1 parent 4374a8b commit cb8edb355bd906c7cd96b7590c859d1a9466cb5d @abo-abo committed Jul 6, 2016
Showing with 14 additions and 4 deletions.
  1. +14 −4 le-scheme.el
View
@@ -47,10 +47,20 @@
(with-current-buffer (geiser-repl--buffer-name geiser-impl--implementation)
(let* ((code `(:eval (:scm ,str)))
(ret (geiser-eval--send/wait code))
- (err (geiser-eval--retort-error ret)))
- (if err
- (format "Error: %s" (string-trim (cdr (assoc 'output ret))))
- (format "%s" (cadr (assoc 'result ret)))))))
+ (err (geiser-eval--retort-error ret))
+ (output-str (cdr (assoc 'output ret)))
+ (result-str (cadr (assoc 'result ret))))
+ (cond (err
+ (format "Error: %s" (string-trim output-str)))
+ ((not (equal "" output-str))
+ (concat
+ (propertize
+ output-str
+ 'face 'font-lock-string-face)
+ "\n"
+ result-str))
+ (t
+ result-str)))))
(defun lispy-goto-symbol-scheme (symbol)
(geiser-edit-symbol (make-symbol symbol)))

0 comments on commit cb8edb3

Please sign in to comment.