This is the mail archive of the
guile-emacs@sourceware.cygnus.com
mailing list for the Guile project.
Re: import-lisp-macro
- To: guile-emacs at sourceware dot cygnus dot com
- Subject: Re: import-lisp-macro
- From: Kalle Olavi Niemitalo <tosi at stekt dot oulu dot fi>
- Date: 20 Mar 2000 17:44:33 +0200
- References: <m33dppijgl.fsf@kei.cwru.edu>
The current version (emacs.scm 1.3) of import-lisp-macro can't
handle this:
(let ((msg "Hello!"))
(save-excursion
msg))
because it evaluates the lambda in the wrong place.
The following definition seems to work better. I moved most of
the code emitted by the macro to a new function "call-lisp-macro"
because nested backquotes confuse me. There is still some
nesting; I hope I got it right. I am currently unable to access
SourceForge via SSH so please commit this change for me.
(You could use this mail as the log message. :-) )
(define-private (call-lisp-macro macro-name thunk)
(lispref->scm (lisp-eval `(,macro-name
(scheme-eval '(',thunk))))))
(define-macro (import-lisp-macro macro . rest)
(let ((scheme-name (if (pair? rest) (car rest) macro)))
`(define-macro (,scheme-name . body)
`(',',call-lisp-macro ',',macro (lambda () ,@body)))))
(export import-lisp-macro)