summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-10-15 02:34:21 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-10-15 02:34:21 +0200
commitb007b8801197325f3bd157c383bdfcace0ff57fc (patch)
tree11f183ece13c67111cac6b8716ed905e4569c193 /elisp
parentd56dfe6f1505b99f90a4978dffd0b592fef72a68 (diff)
downloadgeiser-guile-b007b8801197325f3bd157c383bdfcace0ff57fc.tar.gz
geiser-guile-b007b8801197325f3bd157c383bdfcace0ff57fc.tar.bz2
PLT: Evaluation takes into account #lang forms.
This is useful when visiting a file that has not been loaded: the evaluation namespace is provided by its #lang, if any. While i was at it, i also refactored the mess in geiser:load-file.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-plt.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/elisp/geiser-plt.el b/elisp/geiser-plt.el
index 1352e2f..01e10a2 100644
--- a/elisp/geiser-plt.el
+++ b/elisp/geiser-plt.el
@@ -62,14 +62,22 @@ This function uses `geiser-plt-init-file' if it exists."
,@(and init-file (file-readable-p init-file) (list "-f" init-file))
"-f" ,(expand-file-name "plt/geiser.ss" geiser-scheme-dir))))
-(defconst geiser-plt--prompt-regexp "^mzscheme@[^ ]*?> ")
+(defconst geiser-plt--prompt-regexp "^=?mzscheme@[^ ]*?> ")
;;; Evaluation support:
+(defun geiser-plt--language ()
+ (save-excursion
+ (goto-char (point-min))
+ (if (re-search-forward "^#lang +\\([^ ]+?\\) *$" nil t)
+ (intern (match-string-no-properties 1))
+ :f)))
+
(defun geiser-plt--geiser-procedure (proc)
- (let ((proc (intern (format "geiser:%s" proc))))
- `(dynamic-require ''geiser ',proc)))
+ (if (memq proc '(eval compile))
+ `((dynamic-require ''geiser 'geiser:eval) ',(geiser-plt--language))
+ `(dynamic-require ''geiser ',(intern (format "geiser:%s" proc)))))
(defconst geiser-plt--module-re
"^(module +\\([^ ]+\\)")
@@ -89,7 +97,8 @@ This function uses `geiser-plt-init-file' if it exists."
:f)))
(defun geiser-plt--get-module (&optional module)
- (cond ((and (null module) (buffer-file-name))) ;; (geiser-plt--explicit-module)
+ (cond ((and (null module) (buffer-file-name)))
+ ;; (geiser-plt--explicit-module)
((null module) (geiser-plt--implicit-module))
((symbolp module) module)
((and (stringp module) (file-name-absolute-p module)) module)