From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keisuke Nishida To: guile-emacs@sourceware.cygnus.com Subject: Re: import-lisp-macro Date: Sat, 18 Mar 2000 10:47:00 -0000 Message-id: References: <87hfe4mr29.fsf@PC486.Niemitalo.LAN> X-SW-Source: 2000-q1/msg00042.html Keisuke Nishida writes: > Yes, we can do that by defining this: > > (import-lisp-function buffer-substring buffer-substring-lispref) > > (define (buffer-substring . args) > ((apply buffer-substring-lispref args))) Of course, we could add a new macro that does this automatically: (define-macro (import-lisp-function-by-value func . rest) (if (null? (lispref->scm (lisp-apply 'functionp (list func)))) (lisp-apply 'error (list "No such function: %s" func))) (let ((name (if (pair? rest) (car rest) func))) `(define (,name . args) (lispref->scm (lisp-apply ',func args))))) (export import-lisp-function-by-value) (import-lisp-function-by-value buffer-substring) This works in the previous manner. I guess all functions that return a number, symbol, or string may be imported by using this.