summaryrefslogtreecommitdiff
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
commit1c22cbac3b250d2a250cc52579420a287a5aa112 (patch)
treeb1f0c22cbaff1ebad3ab5d774cefcd3638070cde
parent35b197790ab8fccde81c54c9cfd01aea5db36e87 (diff)
downloadgeiser-1c22cbac3b250d2a250cc52579420a287a5aa112.tar.gz
geiser-1c22cbac3b250d2a250cc52579420a287a5aa112.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.
-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)