From b007b8801197325f3bd157c383bdfcace0ff57fc Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 15 Oct 2009 02:34:21 +0200 Subject: 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. --- elisp/geiser-plt.el | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'elisp') 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) -- cgit v1.2.3