Fwd: Extra file descriptor callbacks

2006-06-18 Thread Brad Beveridge

I accidentally posted to individuals, not the list - damn Gmail!
Brad

On 16/06/06, John (Eljay) Love-Jensen [EMAIL PROTECTED] wrote:

Emacs can do everything:  it's an editor, an environment, an operating system 
(in the same sense that JVM is an operating system), and a religion.  The only 
thing emacs lacks is a good editor.  And now, emacs would have a fantastic 
editor: Vim!


I'm not sure if I am reading you right, but we are not aiming for any
sort of Emacs compatibility.  Slime is a debugger for Lisp, it has two
parts a backend that runs in a Common Lisp image called Swank, and a
frontend that runs in Emacs and is written in ELisp (Emacs' Lisp
dialect).
Our project is attempting to re-implement the frontend only, we will
crib code heavily from the existing Slime frontend, but Elisp is not
the same as CLisp so some stuff will need to be different.  And of
course, Slime relies heavily on Emacs specific drawing functions that
won't port at all.

Really the only relationship we have to Emacs is there is an existing
code base with the functionality we need, and that existing base
happens to run in Emacs.

Cheers
Brad


Fwd: Extra file descriptor callbacks

2006-06-18 Thread Brad Beveridge

Repost: to the actual list this time:

On 16/06/06, Yakov Lerner [EMAIL PROTECTED] wrote:

On 6/16/06, Bram Moolenaar [EMAIL PROTECTED] wrote:
 Brad Beveridge wrote:
  Hello all, I am involved in a project that has embedded ECL
  (http://ecls.sourceforge.net/), a Lisp interpreter into Vim.

Is the next goal of this project to have emacs runnnig inside
List interpreter inside Vim :-) ?


Heaven forbid!!! :)  The main goal of the project is to get Slime
(http://common-lisp.net/project/slime/) running in Vim.  Slime is a
Lisp debugger that uses Emacs as the frontend, and the Emacs side is
written in ELisp.  Just trying to make it so Emacs isn't the only
decent Lisp development environment :)

Cheers
Brad


Extra file descriptor callbacks

2006-06-12 Thread Brad Beveridge

Hello all, I am involved in a project that has embedded ECL
(http://ecls.sourceforge.net/), a Lisp interpreter into Vim.  Our end
goal for the project involves having Lisp code inside of Vim respond
to incoming data from a socket, so we also have a patch that allows us
to register callbacks that will be triggered when we receive data on a
file descriptor.
The code for this is here http://theclapp.org/repos/.  The async
callback patch only really works for GTK and console I think.
Basically all the patch does is add a few more file descriptors to
poll/select on during Vim's read_char, if the appropriate descriptor
is triggered then we get a callback to Lisp.

The callbacks all appear to work fine, for example you can setup a
listening socket in Vim and have data output to a Vim buffer without
any problems.  But there is a bug.  Lets assume that we have a server
that simply echoes back data, and a client that sends data.
Data flow is something like:
(CLIENT) Embedded Lisp script sends data
(SERVER) Echoes data back
(CLIENT) Still sending data, there is also pending data coming back
from the server
(CLIENT) Finishes sending data, next time through the read_char loop
should trigger call back which will read data out from the socket.

However, the CLIENT side crashes in this scenario, it appears to crash
inside the Lisp interpreter.  I suspect that somehow the last two
phases above are overlapping, and the interpreter is being re-entered,
which I don't think it supports.  However, I don't see how this can be
happening - as far as I am aware Vim is totally single threaded (at
least *nix console builds), so the behaviour should be deterministic,
the data will finish sending, continue out to the main loop and then
trigger the callback.

I know it is a lot to ask for help on such a modified Vim, but this is
really starting to get me down.  I would really appreciate any
thoughts about what might be going on, or how to debug this.

Cheers
Brad