This is the mail archive of the
guile-emacs@sourceware.cygnus.com
mailing list for the Guile project.
Re: special forms (save-excursion)
- To: Keisuke Nishida <kxn30 at po dot cwru dot edu>
- Subject: Re: special forms (save-excursion)
- From: Kalle Olavi Niemitalo <tosi at ees2 dot oulu dot fi>
- Date: 15 Mar 2000 10:34:12 +0200
- Cc: guile-emacs at sourceware dot cygnus dot com
- References: <87n1o1p9kt.fsf@PC486.Niemitalo.LAN> <m3snxtb3sh.fsf@kei.cwru.edu>
[I'm on this list now]
Keisuke Nishida <kxn30@po.cwru.edu> writes:
> If you could contribute some macros, I'd very appreciate it and
> include it in the distribution.
Perhaps I can. But I tend to get bored with things so don't take this
as a promise.
Should the macros be in module (emacs import), if they correspond to
Emacs features?
If it were possible to pass Scheme procedure objects to Emacs Lisp and
call them from there, save-excursion could use the existing primitive:
(define-syntax save-excursion
(syntax-rules ()
((save-excursion body ...)
(emacs-eval `(save-excursion
(,(lambda ()
body ...)))))))
This would convert the body forms to a Scheme thunk and then evaluate
an Emacs form which calls that thunk within save-excursion. LAMBDA
captures the current bindings so lexical scoping would be preserved.
Here's another version which uses guile-eval instead of directly
calling the procedure from Emacs. But it too needs the new type.
(define-syntax save-excursion
(syntax-rules ()
((save-excursion body ...)
(emacs-eval `(save-excursion
(guile-eval '(',(lambda ()
body ...))))))))
You wrote you'd rename emacs-eval and emacs-apply.
What are the new names?