summaryrefslogtreecommitdiff
path: root/elisp/geiser-eval.el
diff options
context:
space:
mode:
Diffstat (limited to 'elisp/geiser-eval.el')
-rw-r--r--elisp/geiser-eval.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index 68ef1ca..ee04139 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -26,6 +26,7 @@
;;; Code:
(require 'geiser-connection)
+(require 'geiser-syntax)
(require 'geiser-log)
(require 'geiser-base)
@@ -38,8 +39,10 @@
((eq code :t) "#t")
((listp code)
(cond ((eq (car code) :gs) (geiser-eval--gs (cdr code)))
+ ((eq (car code) :ge) (format "(@ (geiser emacs) %s)" (cadr code)))
((eq (car code) :scm) (cadr code))
(t (concat "(" (mapconcat 'geiser-eval--scheme-str code " ") ")"))))
+ ((symbolp code) (format "%s" code))
(t (format "%S" code))))
(defsubst geiser-eval--gs (code)
@@ -48,19 +51,8 @@
") (quote "
(or (and (nth 1 code)
(geiser-eval--scheme-str (nth 1 code)))
- (geiser-eval--buffer-module))
+ (geiser-syntax--buffer-module))
"))"))
-
-;;; Current module:
-
-(defun geiser-eval--buffer-module (&optional buffer)
- (let ((buffer (or buffer (current-buffer))))
- (with-current-buffer buffer
- (save-excursion
- (goto-char (point-min))
- (if (re-search-forward "(define-module +\\(([^)]+)\\)" nil t)
- (match-string-no-properties 1)
- "#f")))))
;;; Code sending:
@@ -116,6 +108,17 @@
(defsubst geiser-eval--error-msg (err) (cdr (assoc 'msg err)))
(defsubst geiser-eval--error-rest (err) (cdr (assoc 'rest err)))
+(defun geiser-eval--error-str (err)
+ (let* ((key (geiser-eval--error-key err))
+ (subr (geiser-eval--error-subr err))
+ (subr-str (if subr (format " (%s)" subr) ""))
+ (msg (geiser-eval--error-msg err))
+ (msg-str (if msg (format ": %s" msg) ""))
+ (rest (geiser-eval--error-rest err))
+ (rest-str (if rest (format " %s" rest) "")))
+ (format "Error%s: %s%s%s" subr-str key msg-str rest-str)))
+
+
(provide 'geiser-eval)
;;; geiser-eval.el ends here