summaryrefslogtreecommitdiff
path: root/elisp/geiser-eval.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-30 04:57:31 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-30 04:57:31 +0200
commit92ebee294b4d66abbbb3250ce910239427c48ebb (patch)
treefecbd5833c0af3664f9dd6d7b7dccec683d84799 /elisp/geiser-eval.el
parentfcc581bea01856c8c644bf3e312c2369949b353f (diff)
downloadgeiser-92ebee294b4d66abbbb3250ce910239427c48ebb.tar.gz
geiser-92ebee294b4d66abbbb3250ce910239427c48ebb.tar.bz2
Elisp: more flexible parsing of :eval and :ge forms
This allows the implementation decide the concrete structure of the code sent to the REPL. For instance, it doesn't need to be a single s-expression, and argument order can be re-arranged.
Diffstat (limited to 'elisp/geiser-eval.el')
-rw-r--r--elisp/geiser-eval.el41
1 files changed, 23 insertions, 18 deletions
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index fd769db..df31594 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -53,42 +53,46 @@ symbol-location, module-location, symbol-documentation,
module-exports, autodoc, callers, callees and generic-methods.")
(defun geiser-eval--supported-p (feat)
- (not (memq feat geiser-eval--unsupported)))
+ (or (not geiser-eval--unsupported)
+ (not (memq feat geiser-eval--unsupported))))
-(defsubst geiser-eval--form (proc)
- (when (and geiser-eval--unsupported (memq proc geiser-eval--unsupported))
+(defsubst geiser-eval--form (&rest args)
+ (when (not (geiser-eval--supported-p (car args)))
(error "Sorry, the %s scheme implementation does not support Geiser's %s"
- geiser-impl--implementation proc))
- (funcall geiser-eval--geiser-procedure-function proc))
+ geiser-impl--implementation (car args)))
+ (apply geiser-eval--geiser-procedure-function args))
;;; Code formatting:
(defsubst geiser-eval--eval (code)
- (geiser-eval--scheme-str
- `(,(geiser-eval--form 'eval) (quote ,(nth 0 code))
- (:module ,(nth 1 code)))))
+ (geiser-eval--form 'eval
+ (geiser-eval--module (nth 1 code))
+ (geiser-eval--scheme-str (nth 0 code))))
(defsubst geiser-eval--comp (code)
- (geiser-eval--scheme-str
- `(,(geiser-eval--form 'compile)
- (quote ,(nth 0 code)) (:module ,(nth 1 code)))))
+ (geiser-eval--form 'compile
+ (geiser-eval--module (nth 1 code))
+ (geiser-eval--scheme-str (nth 0 code))))
(defsubst geiser-eval--load-file (file)
- (geiser-eval--scheme-str `(,(geiser-eval--form 'load-file) ,file)))
+ (geiser-eval--form 'load-file
+ (geiser-eval--scheme-str file)))
(defsubst geiser-eval--comp-file (file)
- (geiser-eval--scheme-str `(,(geiser-eval--form 'compile-file) ,file)))
+ (geiser-eval--form 'compile-file
+ (geiser-eval--scheme-str file)))
(defsubst geiser-eval--module (code)
(geiser-eval--scheme-str
(cond ((or (null code) (eq code :t) (eq code :buffer))
- (list 'quote (funcall geiser-eval--get-module-function)))
+ (funcall geiser-eval--get-module-function))
((or (eq code :repl) (eq code :f)) :f)
- (t (list 'quote (funcall geiser-eval--get-module-function code))))))
+ (t (funcall geiser-eval--get-module-function code)))))
-(defsubst geiser-eval--ge (proc)
- (geiser-eval--scheme-str (geiser-eval--form proc)))
+(defsubst geiser-eval--ge (proc args)
+ (apply 'geiser-eval--form (cons proc
+ (mapcar 'geiser-eval--scheme-str args))))
(defun geiser-eval--scheme-str (code)
(cond ((null code) "'()")
@@ -102,7 +106,8 @@ module-exports, autodoc, callers, callees and generic-methods.")
((eq (car code) :comp-file)
(geiser-eval--comp-file (cadr code)))
((eq (car code) :module) (geiser-eval--module (cadr code)))
- ((eq (car code) :ge) (geiser-eval--ge (cadr code)))
+ ((eq (car code) :ge) (geiser-eval--ge (cadr code)
+ (cddr code)))
((eq (car code) :scm) (cadr code))
(t (concat "("
(mapconcat 'geiser-eval--scheme-str code " ")