From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keisuke Nishida To: Kalle Olavi Niemitalo Cc: guile-emacs@sourceware.cygnus.com Subject: Re: import-lisp-macro Date: Mon, 20 Mar 2000 16:04:00 -0000 Message-id: References: <87puspfxy5.fsf@PC486.Niemitalo.LAN> X-SW-Source: 2000-q1/msg00045.html Kalle Olavi Niemitalo writes: > 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. That's right. > 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) Thanks. I'll commit this soon. Could you extend this so that it handles with-current-buffer properly? Maybe defining a new macro import-lisp-macro-1 is better.