Getting vim to communicate with a newlisp process?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
camperman
Posts: 12
Joined: Sat Jun 10, 2006 9:16 pm

Getting vim to communicate with a newlisp process?

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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

camperman
Posts: 12
Joined: Sat Jun 10, 2006 9:16 pm

Post by camperman »

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

Locked