Page 1 of 1

Getting vim to communicate with a newlisp process?

Posted: Thu Jun 22, 2006 9:52 am
by camperman
Hi all,

I'm trying to duplicate Larry Clapp's rather nice little hack which allows vim to communicate with CL via a pipe - except using newLISP (of course) and a socket connection. Ultimately I want to write a vim plugin that lets you send sexps and buffers to a running newLISP process.

So I start up newLISP like so:

newlisp -d 1234

and then I test from python:

ipython:

import socket
host = "localhost"
port = "1234"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send("(+ 10 10)")
>> 8 # no of bytes sent
s.recv(1024)
>> 'newLISP v.8.8.0 on linux.\n\n> '

And now I'm stuck. I can't see how to either a) get the newLISP process to echo results back to me or b) to actually see what it's doing. Should I do this in a handler?

TIA...

Posted: Thu Jun 22, 2006 12:44 pm
by Lutz
Start up newLISP as you did, but also suppressing the command prompt:

Code: Select all

newlisp -c -d 1234
Now fire up telnet in a different shell (or put newlisp in the background) and see how it works.

Code: Select all

telnet localhost 1234
or from any other client send an expression, i.e. "(+ 3 4)\n" termiated by line-feed. newLISP works now in interactive mode supressing the prompt character and signon line. You can send any newLISP expression terminated by a line-feed and read the output back from the same socket.

Lutz

Posted: Thu Jun 22, 2006 1:16 pm
by camperman
Duh - I forgot about the \n. Thanks Lutz - all works fine now.