diff options
author | Andy Wingo <wingo@pobox.com> | 2009-04-25 19:09:19 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-04-25 19:09:19 +0200 |
commit | 39f30ea29df55eda3f92d0cf68f1f89282a1418e (patch) | |
tree | 761b29bb45c91881c8358b51bab8d368c122458e /lang/elisp/interface.scm | |
parent | 97ce9dbf2158a08980189bcb3c3016ba30246829 (diff) | |
download | guile-39f30ea29df55eda3f92d0cf68f1f89282a1418e.tar.gz |
Fix the elisp memoizer code for syncase-in-boot-9
* lang/elisp/interface.scm:
* lang/elisp/internals/lambda.scm:
* lang/elisp/primitives/syntax.scm:
* lang/elisp/transform.scm: Use (lang elisp expand) as the transformer,
because we really are intending this code for the memoizer and not the
compiler.
* lang/elisp/expand.scm: A null expander.
* lang/elisp/interface.scm (use-elisp-file, use-elisp-library):
* lang/elisp/transform.scm (scheme): Turn these defmacros into
procedure->memoizing-macro calls, given that without syncase we have no
defmacro either.
* lang/elisp/primitives/fns.scm (macroexpand): Comment out, as Scheme's
macro expander (temporarily on hiatus) won't work with elisp.
Diffstat (limited to 'lang/elisp/interface.scm')
-rw-r--r-- | lang/elisp/interface.scm | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/lang/elisp/interface.scm b/lang/elisp/interface.scm index 1e0758569..fcd748f65 100644 --- a/lang/elisp/interface.scm +++ b/lang/elisp/interface.scm @@ -1,4 +1,5 @@ (define-module (lang elisp interface) + #:use-syntax (lang elisp expand) #:use-module (lang elisp internals evaluation) #:use-module (lang elisp internals fset) #:use-module ((lang elisp internals load) #:select ((load . elisp:load))) @@ -66,31 +67,39 @@ one of the directories of @code{load-path}." (string->symbol (string-append "imports:" (number->string counter))))))) -(define-macro (use-elisp-file file-name . imports) - "Load Elisp code file @var{file-name} and import its definitions +(define use-elisp-file + (procedure->memoizing-macro + (lambda (exp env) + "Load Elisp code file @var{file-name} and import its definitions into the current Scheme module. If any @var{imports} are specified, they are interpreted as selection and renaming specifiers as per @code{use-modules}." - (let ((export-module-name (export-module-name))) - `(begin - (fluid-set! ,elisp-export-module (resolve-module ',export-module-name)) - (beautify-user-module! (resolve-module ',export-module-name)) - (load-elisp-file ,file-name) - (use-modules (,export-module-name ,@imports)) - (fluid-set! ,elisp-export-module #f)))) + (let ((file-name (cadr exp)) + (env (cddr exp))) + (let ((export-module-name (export-module-name))) + `(begin + (fluid-set! ,elisp-export-module (resolve-module ',export-module-name)) + (beautify-user-module! (resolve-module ',export-module-name)) + (load-elisp-file ,file-name) + (use-modules (,export-module-name ,@imports)) + (fluid-set! ,elisp-export-module #f))))))) -(define-macro (use-elisp-library library . imports) - "Load Elisp library @var{library} and import its definitions into +(define use-elisp-library + (procedure->memoizing-macro + (lambda (exp env) + "Load Elisp library @var{library} and import its definitions into the current Scheme module. If any @var{imports} are specified, they are interpreted as selection and renaming specifiers as per @code{use-modules}." - (let ((export-module-name (export-module-name))) - `(begin - (fluid-set! ,elisp-export-module (resolve-module ',export-module-name)) - (beautify-user-module! (resolve-module ',export-module-name)) - (load-elisp-library ,library) - (use-modules (,export-module-name ,@imports)) - (fluid-set! ,elisp-export-module #f)))) + (let ((library (cadr exp)) + (env (cddr exp))) + (let ((export-module-name (export-module-name))) + `(begin + (fluid-set! ,elisp-export-module (resolve-module ',export-module-name)) + (beautify-user-module! (resolve-module ',export-module-name)) + (load-elisp-library ,library) + (use-modules (,export-module-name ,@imports)) + (fluid-set! ,elisp-export-module #f))))))) (define (export-to-elisp . defs) "Export procedures and variables specified by @var{defs} to Elisp. |