This is the mail archive of the guile-emacs@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: special forms (save-excursion)


[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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]