From: David J Cooper Jr
Subject: Executing Emacs Lisp code from Common Lisp?
Date: 
Message-ID: <35034CFC.7928F258@genworks.com>
    In Allegro Lisp, the Emacs-Lisp interface allows one to evaluate CL
forms from within an Emacs Lisp function with the command

    fi:eval-in-lisp

    I am trying to do just the opposite: evaluate some Emacs Lisp code
from within a Common Lisp program.

    Specifically, I am writing an application, one of whose purposes is
to compute some Emacs Lisp code which performs a modification to each
file in a subdirectory tree, according to certain rules. My CL object
computes a list of a bunch of Emacs Lisp forms, each of which look
something like the following:


(let ((buffer "foo.lisp")

      (file  "/goo/bar/foo.lisp")

      (package ":mypackage"))

  (find-file file)

  (set-buffer buffer)

  (set-package package)

  (save-buffer)

  (kill-buffer buffer))

I can happily copy and paste this code to an Emacs *scratch* buffer and
evaluate it, and it performs exactly as desired. Or I can save it to a
file and load-file the file in emacs, and it performs as desired.

But what I really want to do is automatically call across the Emacs-Lisp
interface from CL into Emacs, and cause the Emacs process to evaluate
the form (kind of making Emacs be the server and CL be the client).

This must be possible, because the ICAD defpart browser has certain
features where you can select things with the mouse and cause files to
be visited in Emacs, and bring the Emacs window into the current
workspace, etc.  Anyone have a clue as to how do they do that?

--
David J Cooper Jr                                       Genworks International
········@genworks.com                                   http://www.genworks.com

 ...Embracing an Open Systems Approach to Knowledge-based Engineering...