Hi,
I think this is the one you mean. I now have code working using this
approach.
cheers,
----- Forwarded message from Jim Snyder <[EMAIL PROTECTED]> -----
From: "Jim Snyder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Fw: look for direction and an example of Java/Lisp communication....
Date: Fri, 22 Mar 2002 12:32:43 -0500
Hello All ....
I asked Paul a simple question of how Java/Lisp communicate together in JDEE
b/c I want to write a simple utility for my own use. Below is Paul's very
helpful response.
Jim
----- Original Message -----
From: "Paul Kinnucan" <[EMAIL PROTECTED]>
To: "Jim Snyder" <[EMAIL PROTECTED]>
Sent: Friday, March 22, 2002 10:56 AM
Subject: look for direction and an example of Java/Lisp communication....
> Hi Jim,
>
> The JDEE uses the BeanShell to execute all the Java code that
> implements Java-based features. I advise that you go the same
> route.
>
> Here is the approach the JDEE uses. Suppose you want to
> use Java to implement an extension to Emacs. Okay, go ahead
> and write the extension as an ordinary Java application.
> Assume that your application will talk to Emacs via standard
> I/O. Also assume that when you want to talk to Emacs that
> your Java app will emit Lisp forms that Emacs can evaluate.
> In other words, when your Java app wants Emacs to do something
> it should do something like this:
>
> System.out.println("(some-fcn arg1 arg2)");
>
> where some-fcn is any standard Emacs Lisp function or a Lisp function
> that you have written and included in your Emacs Lisp load-path
> and required so that it is defined in the Emacs Lisp symbol space
> when your Java app is running.
>
> Also, write a Lisp interface to your Java app that uses Java
> to talk to your Java app, i.e., whenever your Lisp code wants
> your Java code to do something, it invokes a static method
> in your Java code that does the desired action, using the
> jde-jeval function, a standard JDEE function. Here is an
> example:
>
> (jde-jeval "com.mycom.myapp.Main.doSomething(\"some string\", 1);"
>
> The jeval form passes the statement
>
> com.mycom.myapp.Main.doSomething("some string", 1);
>
> to the BeanShell which then executes it, thereby invoking your
> doSomething method with the arguments "some string" and 1. This
> assumes that the classes that implement your application are on the
> BeanShell's classpath when it starts. You can assure this by including
> your classes are in jde-global-classpath.
>
> There is a variant of jde-jeval, jde-jeval-r, that waits for your app
> to return a Lisp form. It evaluates the form and returns the
> result. This lets you in effect write a static Java method
> that returns a result to Emacs, e.g.,
>
> (let ((values
> (jde-jeval-r "com.mycom.myApp.getValues();")))
> (if values
> (my-process-values values)
> (my-do-something-else)))
>
>
> There are many JDEE "wizards" that use this method of
> extending Emacs via Java. See jde-wiz.el for the lisp
> side of these extensions and JDEEROOT/java/src/jde/wizards
> for examples of the Java classes that implement them.
>
> Hope this helps,
>
> Paul
>
> Jim Snyder writes:
> > Dear Paul....
> >
> > I have a quick question about the distribution of the files in the tar
file: mainly the .java files and the .el lisp files.
> >
> > Where in JDEE's code does lisp call upon Java for something? Likewise,
where might Java call upon lisp functions? I am naive when it comes to lisp
and am assuming there are these communications because of the .java source
that is distrubted with the jdee tar file.
> >
> > The reason why I ask, is our code manager (SCCS) (and devlopment using
emacs/jdee of course) resides on a Solaris 2.8 box; while a faster unix box
(linux) could be used for actual development using emacs/jdee of course ;-).
However, Linux does not have a version of SCCS. Thus I would like to run my
emacs/jdee on the linux box and when I want to check in/out files, the
actual command (initiated by emacs environment on linux) is sent (via Java
that I wrote running on the linux box) over to the Sun box running another
Java application I wrote to actually do the check in/out in sccs. When the
SCCS command is done on the Solaris box, the command returns to the Java
application on the linux box and back to the lisp code that initiated the
call to begin with. All of this communication is synchronous.
> >
> > I guess the answer I am look for from you is something as follows:
> >
> > As a starter, look in jdee-foo.el and search for this string "foo-bar".
This foo-bar calls a method in this .java file.
> >
> >
> >
> > emacs version: 20.7
> >
> > JDEE env:
> >
> > JDE_ELIB_VERSION=1.0
> > JDE_EIEIO_VERSION=0.17beta3
> > JDE_ECB_VERSION=1.31
> > JDE_VERSION=2.2.9beta7
> > JDE_SPEEDBAR_VERSION=0.13a
> > JDE_SEMANTIC_VERSION=1.4beta11
> >
> > Much thanks...Jim
> >
> >
> > ________________________
> > Jim Snyder
> > Copper Key Technologies
> > 402 High Point Dr., #201
> > Cocoa, FL. 32926
> > www.copperkey.com
> > 321.635.8194
> > [EMAIL PROTECTED]
> >
> > I have a quick question about the distribution of
> > the files in the tar file: mainly the .java files and the .el lisp
> > files.
> > Where in JDEE's code does lisp call upon Java for
> > something? Likewise, where might Java call upon lisp functions? I am
naive when
> > it comes to lisp and am assuming there are these communications because
of the
> > .java source that is distrubted with the jdee tar file.
> >
> > The reason why I ask, is our code manager (SCCS)
> > (and devlopment using emacs/jdee of course) resides on a Solaris 2.8
box; while
> > a faster unix box (linux) could be used for actual development
using
> > emacs/jdee of course ;-). However, Linux does not have a version of
SCCS. Thus I
> > would like to run my emacs/jdee on the linux box and when I want to
check in/out
> > files, the actual command (initiated by emacs environment on linux) is
sent (via
> > Java that I wrote running on the linux box) over to the Sun box running
another
> > Java application I wrote to actually do the check in/out in sccs. When
the SCCS
> > command is done on the Solaris box, the command returns to the Java
application
> > on the linux box and back to the lisp code that initiated the call to
begin
> > with. All of this communication is synchronous.
> >
> > I guess the answer I am look for from you is something as follows:
> > As a starter, look in jdee-foo.el and search for
> > this string "foo-bar". This foo-bar calls a method in this .java
> > file.
----- End forwarded message -----
--
Graham Bennett
[EMAIL PROTECTED] ICQ: 17566658