public inbox for guile-emacs@sourceware.org
 help / color / mirror / Atom feed
From: Keisuke Nishida <kxn30@po.cwru.edu>
To: Kalle Olavi Niemitalo <tosi@ees2.oulu.fi>
Cc: guile-emacs@sourceware.cygnus.com
Subject: Re: special forms (save-excursion)
Date: Wed, 15 Mar 2000 03:32:00 -0000	[thread overview]
Message-ID: <m3d7owlb9l.fsf@kei.cwru.edu> (raw)
In-Reply-To: <iznbt4gy6m3.fsf@stekt.oulu.fi>

Kalle Olavi Niemitalo <tosi@ees2.oulu.fi> writes:

> Should the macros be in module (emacs import), if they correspond to
> Emacs features?

A new module (emacs macro) might be better.

> 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 ...)))))))

Well, in this way, you can't write this:

(let ((start (point)))
  (save-excursion
    (goto-char start)))

> 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 ...))))))))

This looks better in this case.  Probably many of Lisp macros can be
implemented this way, except some others such as `unwind-protect'
(but we already have `dynamic-wind').  I guess I should add the new
Lisp type, but... a problem can be we have to convert Scheme's #t
and #f into the special type instead of t and nil.  But this may
not be a problem since we can return a symbol t or nil to Lisp anyway.
(And it can be done automatically in some way.)

OK, I'll try to add the type soon.  I guess you can define a new
macro `import-lisp-macro'.

> You wrote you'd rename emacs-eval and emacs-apply.
> What are the new names?

New primitives will be:

  lisp-eval, lisp-apply, scheme-eval, scheme-apply

New Scheme procedures/macros will be:

  lisp-true?, lisp-false?,
  lisp-variable-ref, lisp-variable-set!,
  import-lisp-function, import-lisp-variable

and perhaps:

  define-global-varialbe, define-command

In addition, I could implement import-scheme-procedure or something
for Emacs Lisp.

Hopefully I am releasing the next version within today.

  reply	other threads:[~2000-03-15  3:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-14 12:46 Kalle Olavi Niemitalo
2000-03-14 13:32 ` Keisuke Nishida
2000-03-14 14:11 ` Keisuke Nishida
2000-03-14 14:17   ` Keisuke Nishida
2000-03-15  0:34   ` Kalle Olavi Niemitalo
2000-03-15  3:32     ` Keisuke Nishida [this message]
2000-03-15  5:11       ` Kalle Olavi Niemitalo
2000-03-15  5:43         ` Keisuke Nishida
2000-03-15  6:12           ` Kalle Olavi Niemitalo
2000-03-15 11:37             ` guile-emacs GC (was special forms) Kalle Olavi Niemitalo
2000-03-15 12:18               ` Keisuke Nishida
2000-03-15 13:48                 ` Jim Blandy
2000-03-15 15:14                   ` Keisuke Nishida
2000-03-15 11:30           ` special forms (save-excursion) Kalle Olavi Niemitalo
2000-03-15 12:42             ` Keisuke Nishida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d7owlb9l.fsf@kei.cwru.edu \
    --to=kxn30@po.cwru.edu \
    --cc=guile-emacs@sourceware.cygnus.com \
    --cc=tosi@ees2.oulu.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).