Getting vim to communicate with a newlisp process?

Started by camperman, June 22, 2006, 02:52:05 AM

Previous topic - Next topic

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.nn> '



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

Lutz

#1
Start up newLISP as you did, but also suppressing the command prompt:

newlisp -c -d 1234


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



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

camperman

#2
Duh - I forgot about the n. Thanks Lutz - all works fine now.