From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kalle Olavi Niemitalo To: Keisuke Nishida Cc: guile-emacs@sourceware.cygnus.com Subject: Re: special forms (save-excursion) Date: Wed, 15 Mar 2000 00:34:00 -0000 Message-id: References: <87n1o1p9kt.fsf@PC486.Niemitalo.LAN> X-SW-Source: 2000-q1/msg00010.html [I'm on this list now] Keisuke Nishida 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?